Hello
Why this code write message in the row 0 when it should writes only in row 1 (The scroll loop). This happen when the message is longer than 1234567890123456789012345
Help
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
char * message = "123456789012345678901234567890";
void setup()
{
lcd.init();
lcd.begin (16,2);
lcd.backlight();
lcd.setCursor(1,0);
lcd.print(" Good Morning");
}
void loop()
{
for (int printStart = 15; printStart >= 0; printStart--) //scroll on from right
{
showLetters(printStart, 0);
}
for (int letter = 1; letter <= strlen(message); letter++) //scroll off to left
{
showLetters(0, letter);
}
}
void showLetters(int printStart, int startLetter)
{
lcd.setCursor(printStart,1);
for (int currentLetter = startLetter; currentLetter < strlen(message); currentLetter++)
{
lcd.print(message[currentLetter]);
}
lcd.print(" ");
delay(250);
}