Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
faduino:faduino:clcdwithfaduino:index [2026/02/10 23:21] adminfaduino: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 <Wire.h> +#include    <Wire.h> 
-#define ADDR_CLCD 0 +#define     ADDR_CLCD             
-...+  
 +unsigned char   locate_x; 
 +unsigned char   locate_y; 
 +  
 +void clcd_clear             (); 
 +void clcd_cursor_visible    (bool enable); 
 +void clcd_backLight_enable  (bool enable); 
 +void clcd_print             (String value); 
 +void clcd_locate            (unsigned char x, unsigned char y); 
 +  
 +void setup() { 
 +  Wire.begin();                     // 마스터모드로 동작 
 +  Wire.setClock(500000);            // 500 kHz. 
 +  clcd_clear();                     // 화면 전채를 지움 
 +  clcd_cursor_visible(false);       // 커서 설정 
 +  clcd_backLight_enable(true);      // 백라이트 설정 
 +  clcd_locate(0,4);                 // 문자 표시 위치 
 +  clcd_print("COMFILE_TECH");       // 문자 표시 
 +  clcd_locate(2,5); 
 +  clcd_print("0123456789"); 
 +
 +  
 +void loop() { 
 +
 +  
 +void clcd_clear(){ 
 +  unsigned char tmp_buf[] = {0x1b,0x43}; 
 +  Wire.beginTransmission(ADDR_CLCD); 
 +  Wire.write(tmp_buf,2); 
 +  Wire.endTransmission(); 
 +  delay(200); 
 +
 +  
 +void clcd_cursor_visible(bool enable){ 
 +  unsigned char tmp_buf[] = {0x1b,enable == true ? 0x53 : 0x73}; 
 +  Wire.beginTransmission(ADDR_CLCD); 
 +  Wire.write(tmp_buf,2); 
 +  Wire.endTransmission(); 
 +
 +void clcd_backLight_enable(bool enable){ 
 +  unsigned char tmp_buf[] = {0x1b,enable == true ? 0x42 : 0x62}; 
 +  Wire.beginTransmission(ADDR_CLCD); 
 +  Wire.write(tmp_buf,2); 
 +  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,0x4b,locate_y,locate_x,locate_y,locate_x}; 
 +  Wire.beginTransmission(ADDR_CLCD); 
 +  Wire.write(tmp_buf,6); 
 +  Wire.write(value.c_str()); 
 +  Wire.write(0); 
 +  Wire.endTransmission(); 
 +}
 </code> </code>
 ++++ ++++