I modified this code:
#include <SoftwareSerial.h>
#define txPin 2
SoftwareSerial LCD = SoftwareSerial(0, txPin);
// since the LCD does not send data back to the Arduino, we should only define the txPin
const int LCDdelay=10; // conservative, 2 actually works
// wbp: goto with row & column
void goTo(int row, int col) {
LCD.print(0xFE, BYTE); //command flag
LCD.print((col + row*64 + 128), BYTE); //position
delay(LCDdelay);
}
void clearLCD(){
LCD.print(0xFE, BYTE); //command flag
LCD.print(0x01, BYTE); //clear command.
delay(LCDdelay);
}
void backlightOn() { //turns on the backlight
LCD.print(0x7C, BYTE); //command flag for backlight stuff
LCD.print(157, BYTE); //light level.
delay(LCDdelay);
}
void backlightOff(){ //turns off the backlight
LCD.print(0x7C, BYTE); //command flag for backlight stuff
LCD.print(128, BYTE); //light level for off.
delay(LCDdelay);
}
void serCommand(){ //a general function to call the command flag for issuing all other commands
LCD.print(0xFE, BYTE);
}
void setup()
{
pinMode(txPin, OUTPUT);
LCD.begin(9600);
clearLCD();
goTo(0,0);
LCD.print("Hello world!");
}
void loop()
{
}
Which I found on this page: Arduino Playground - SparkFunSerLCD