#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); //define I2C address 0x27, 16 column and 2 rows
void setup()
{
lcd.init();
lcd.clear();
lcd.backlight();
lcd.setCursor(2,0);
lcd.print("Orville's");
lcd.setCursor(2,1);
lcd.print("XMAS Show");
delay(2000);
lcd.print("hello");
}
void loop() {
delay(10);
// do something
// added this code from https://www.electroniclinic.com/arduino-lcd-autoscroll-16x2-lcd-text-scrolling-running-text-lcd/
// scroll 16 positions (display length + string length) to the left
// to move it back to center:
for (int positionCounter = 16; positionCounter > 0; positionCounter--) {
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(500);
}
delay(1000);
// scroll 29 positions (string length + display length) to the right
// to move it offscreen right:
for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
// scroll one position right:
lcd.scrollDisplayRight();
// wait a bit:
delay(500);
}
}