LCD serial display

Hello,

I came across a small issue while trying to get a 16x2 lcd to display characters received from the PC via USB.
I tried using the SerialDisplay example, but it only displays values on the first line.
I don't know how to change the rows when the first row gets to the 16th character...
Simply put: I want to write data on the first line and when it gets to the 16th character I want the values to be displayed automatically on the second line.
How do I do that ?

Thank you
A.

Please post your code and the type of LCD display.

The code is the one in the examples that came with Arduino IDE:

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup(){
  lcd.begin(16, 2);
  Serial.begin(9600);
}

void loop()
{
  if (Serial.available()) {
    delay(100);
    lcd.clear();
    while (Serial.available() > 0) {
      lcd.write(Serial.read());
    }
  }
}

Keep a count of how many characters you have displayed, and when you get to 16, use lcd.setCursor() to reposition onto the second line.

Ok.. I don't know how to actually count the incoming bytes that arduino receives from the PC... How do I do that ?!

How do I do that ?!

1, 2, 3, 4, 5,...

Add some integer variable. Set it to 0 at the appropriate place. Increment it whenever a character is read.

PaulS:

How do I do that ?!

1, 2, 3, 4, 5,...

Add some integer variable. Set it to 0 at the appropriate place. Increment it whenever a character is read.

Thanks for the reply. I didn't see the solution staring me in the face. :blush: