#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
uint8_t smile[8] = {
0b00000,
0b01010,
0b00000,
0b00100,
0b00100,
0b10001,
0b01110,
0b00000,
};
int count = 0;
const int MAX_SCREEN_WIDTH = 16;
const int FIRST_ROW = 0;
const int SECOND_ROW = 1;
void setup() {
lcd.createChar(3, smile);
lcd.begin(16, 2);
lcd.setCursor(MAX_SCREEN_WIDTH, FIRST_ROW);
lcd.print("Hello world! \x03");
}
void loop() {
if (count == 40) {
lcd.clear();
lcd.setCursor(MAX_SCREEN_WIDTH, SECOND_ROW);
lcd.print("Hello world! \x03");
}
if (count == 80) {
lcd.clear();
lcd.setCursor(MAX_SCREEN_WIDTH, FIRST_ROW);
lcd.print("Hello world! \x03");
count = 0;
}
lcd.scrollDisplayRight();
count++;
delay(100);
}