Sparkfun Serial LCD - Just displays 2 last characters


Im currently trying to display "Hello world" on my LCD (Bought it from Sparkfun, Serial LCD 3.3V).

Here's my code:

// Attach the serial display's RX line to digital pin 2
SoftwareSerial mySerial(3,2); // pin 2 = TX, pin 3 = RX (unused)

void setup()
  mySerial.begin(9600); // set up serial port for 9600 baud
  delay(500); // wait for display to boot up

void loop() 
  mySerial.write(254); // cursor to 1st position on first line
  mySerial.write ("Hello world");
  delay(1000); // short delay

But when i start my arduino, it just shows this:


So, the 2nd last characters.
Can someone tell me why this happens? :o

//Edit: I've played around with the code and came to this:

Output: 'allo Welt!'

But why does that happen now? It doesnt make any sense for me.


The cursor seems to swap from line 1, character 1 to line 2 character 1 and back to 1,1 again. This way it overwrites the Hello World always until 'd!' is left. But what is the cause of the problem?

When you have trouble initially getting an LCD working, using either the default parallel connection or a serial interface, it is always a good idea to work with a static example. This means doing your initial work solely in setup() and doing nothing in loop(). Right now you are aiming at a moving target which isn't a good idea for beginners.