Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| faduino:faduino:clcdwithfaduino:index [2026/02/10 23:21] – admin | faduino:faduino:clcdwithfaduino:index [2026/02/20 15:34] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== CLCD와 연결 ====== | ====== CLCD와 연결 ====== | ||
| - | CLCD(Character LCD)는 문자 기반 정보를 표시할 수 있는 LCD 모듈로, | + | CLCD(Character LCD)는 문자 기반 정보를 표시할 수 있는 LCD 모듈로, |
| FADUINO와 연결하여 **상태 표시, 카운터 출력, 간단한 메시지 표시** 등에 사용됩니다. | FADUINO와 연결하여 **상태 표시, 카운터 출력, 간단한 메시지 표시** 등에 사용됩니다. | ||
| Line 134: | Line 134: | ||
| ++++ [소스코드 보기]| | ++++ [소스코드 보기]| | ||
| <code c> | <code c> | ||
| - | #include < | + | # |
| - | #define ADDR_CLCD 0 | + | # |
| - | ... | + | |
| + | unsigned char | ||
| + | unsigned char | ||
| + | |||
| + | void clcd_clear | ||
| + | void clcd_cursor_visible | ||
| + | void clcd_backLight_enable | ||
| + | void clcd_print | ||
| + | void clcd_locate | ||
| + | |||
| + | void setup() { | ||
| + | Wire.begin(); | ||
| + | Wire.setClock(500000); | ||
| + | clcd_clear(); | ||
| + | clcd_cursor_visible(false); | ||
| + | clcd_backLight_enable(true); | ||
| + | clcd_locate(0, | ||
| + | clcd_print(" | ||
| + | clcd_locate(2, | ||
| + | clcd_print(" | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | } | ||
| + | |||
| + | void clcd_clear(){ | ||
| + | unsigned char tmp_buf[] = {0x1b, | ||
| + | Wire.beginTransmission(ADDR_CLCD); | ||
| + | Wire.write(tmp_buf, | ||
| + | Wire.endTransmission(); | ||
| + | delay(200); | ||
| + | } | ||
| + | |||
| + | void clcd_cursor_visible(bool enable){ | ||
| + | unsigned char tmp_buf[] = {0x1b, | ||
| + | Wire.beginTransmission(ADDR_CLCD); | ||
| + | Wire.write(tmp_buf, | ||
| + | Wire.endTransmission(); | ||
| + | } | ||
| + | void clcd_backLight_enable(bool enable){ | ||
| + | unsigned char tmp_buf[] = {0x1b, | ||
| + | Wire.beginTransmission(ADDR_CLCD); | ||
| + | Wire.write(tmp_buf, | ||
| + | Wire.endTransmission(); | ||
| + | } | ||
| + | |||
| + | void clcd_locate(unsigned char x, unsigned char y){ | ||
| + | locate_x = x; | ||
| + | locate_y = y; | ||
| + | } | ||
| + | |||
| + | void clcd_print(String value){ | ||
| + | unsigned char tmp_buf[] = {0x1b, | ||
| + | Wire.beginTransmission(ADDR_CLCD); | ||
| + | Wire.write(tmp_buf, | ||
| + | Wire.write(value.c_str()); | ||
| + | Wire.write(0); | ||
| + | Wire.endTransmission(); | ||
| + | } | ||
| </ | </ | ||
| ++++ | ++++ | ||
