Arduino Serial interface to LCD

Hi all,

I am trying to interface a Serial Enabled 16x2 LCD from sparkfun with my arduino mega but am having some trouble. I can't work out how to simply write commands to the LCD, i use the Serial.print() or Serial.write() functions and type in the command but all it does is print the ASCII character equivalent to that number. Can anyone tell me how to simply send a command?

Here is the code I am using at the moment.

define CLR_DISP (0x01) //Clear display

define CUR_HOME (0x02)

define DISP_OFF (0x10)

define RANDOM (0x63)

void setup(){ Serial1.begin(9600); }

void loop(){ Serial1.print(CLR_DISP); delay(100); }

joel5475:

I don’t have one of these devices but according to the Datasheet you have to transmit a “special character”, before you transmit the command. There’s an example on page 3.

Don

Hi, thanks I read that before but didn't seem to be able to get it working but know i have, and you were right, the special character is 0xFE in hex or 245 decimal. It has to be transmitted imediately before any command with the Serial.write(254) function.

Thanks again

Joel