LCD in ARDUNIO STARTER KIT FAILS

Hope some one here can help us!

We are using the Arduino Starter Kit to do some testing with Unity3D, and for the most part seems to work fairly well EXCEPT for this:

When we send messages to the LCD display through the standard loop function, we are using the serial.read() function to parse some characters to dataLine1 and dataLine2 as shown in the following code snippet:

void loop() {
if (Serial.available() > 0) {

dataLine1 = ...
dataLine2 = ...

lcd.clear();
lcd.setCursor(0, 0);
lcd.print(dataLine1);
lcd.setCursor(0, 1);
lcd.print(dataLine2);
}
...
}

It all works well until it suddenly stops updating the LCD! We think that the lcd.clear() simply stops working.

We know the UNO board is still functioning properly because it sends messages back into our Unity3D setup without any issue. Very frustrating as its extremely unreliable and consistently fails after several loop cycles. I am also trying to avoid using delay() in our code as well as this negatively impacts our real-time nature requirements.

Any ideas how to fix this so it does not occur ?

Thanks in advance for any suggestions.

Try using serial.println(dataline#) after the lcd.prints and see if the same is happening in the serial monitor?

Mine works very well but i do have: delay(1) before lcd.clear()

Let me guess.

You are using string functions, aren't you?

And your Caps Lock key was stuck when you wrote the subject. Careless. :roll_eyes:

Yep Paul___B! My CAPS lock key was most definitely on when I wrote the subject this time ... can anyone hear me !?

Thanks Stokez, my bad! It turns out the serial parser buffer routine I was using was out by 1 in my char array indexing. Was the usual ugly null termination '\o' thingy that always bugs me out!

It's all good and working perfectly now... Also I cant promise I won't use the CAPS key again.

Cheers

JBAH:
It's all good and working perfectly now... Also I cant promise I won't use the CAPS key again.

It's up to you. Many people simply will not answer if you are rude.