comfile cubloc clcd serial lcd controller

I had one of these laying around so I hooked it up... in case anyone needs it.

//  * ------------
//  *  modified for use with cubloc clcd -> by chris coleman
//  *  original code -> Copyleft 2006 by djmatic 
//  *   ------------

void setup()
{
  beginSerial(115200);        
}

void loop()
{ 
  clearLCD();
  Serial.print("Hello");  // print text to the current cursor position
  Line(3);              // start a new line
  Serial.print("Arduino");
  //cursorSet(1,3);
  Serial.print("\t\t\ttest");
  delay(5000);
  backlightOff();
  delay(5000);
  backlightOn();
  delay(5000);
  cursorHome();
  delay(5000);
  cursorOff();
  delay(5000);
}

//  LCD  FUNCTIONS-- keep the ones you need. 

// clear the LCD
void clearLCD(){
  Serial.print(27,BYTE);
  Serial.print("C");
}

// start a new line
void Line(int line) { 
  Serial.print(line,BYTE); 
}

// move the cursor to the home position
void cursorHome(){
  Serial.print(27,BYTE);
  Serial.print("H");
}

// DOES NOT WORK CORRECTLY
// e.g.: cursorSet(3,2) sets the cursor to x = 3 and y = 2
void cursorSet(int xpos, int ypos){  
  Serial.print(27, BYTE);
  Serial.print("L");               
  Serial.print(xpos);   //Column position   
  Serial.print(ypos); //Row position 
  delay(100);
} 

// backspace and erase previous character
void backSpace() { 
  Serial.print(8, BYTE); 
}

// turn cursor On (default)
void cursorOn(){    
  Serial.print(27, BYTE); 
  Serial.print("S");     
}

// turn cursor Off
void cursorOff(){
  Serial.print(27, BYTE); 
  Serial.print("s");    
}

// turn on backlight
void backlightOn(){
  Serial.print(27, BYTE); 
  Serial.print("B");    
}

// turn off backlight
void backlightOff(){
  Serial.print(27, BYTE); 
  Serial.print("b");    
}

Hi, Chris, and djmatic.

I've been looking for some help for my Comfile Cubloc CLCD(20colx4row), and finally I found your nice code. I myself am not familiar with the Arduino Sketch yet. Some Arduino sketch I found at this site for I2C feature for some other make did not seem to fit for the Cubloc CLCD .
The sketch you have prepared gave me the characters, "arduino", "test", and "hello" at readable places on the LCD.
I will learn more about controlling of clear-screen, and character positions.

Thank you so much. :slight_smile:

Bryan

Dear Chris, and djmatic.

When the CLCD is connected as serial(rx, power +5v, gnd) as you suggested, it works great.
The backlight on/off function, and cursor on/off function you prepared all work perfect.
I think the line looks like a typo.
beginSerial( ...) -> Serial.begin(115200);
As a noobie, the frustration against CLCD blew away with your sketch.
Thanks again :slight_smile:
Bryan