#include <LiquidCrystal.h>
const byte rs = 12;
const byte en = 11;
const byte d4 = 5;
const byte d5 = 4;
const byte d6 = 3;
const byte d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int ButtonPin = 10;
int ButtonVal = 0;
void setup() {
pinMode(ButtonPin, INPUT_PULLUP);
lcd.begin(16, 2); // set up the LCD's number of columns and rows
}
void loop() {
ButtonVal = digitalRead(ButtonPin);
if (ButtonVal == LOW) {
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
// 10 20 30 40 50 60 70 80
// 012345678901234567890123456789012345678901234567890123456789012345678901234567890
//lcd.print("Really long message to display0123456789");
// 1234567890
lcd.print(" Really long message to display"); // scroll "n" positions (string length) to the left to move it offscreen left:
for (int positionCounter = 0; positionCounter < 30; positionCounter++) {
delay(250); // wait a bit
lcd.scrollDisplayLeft();
}
lcd.clear();
}
}