#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int num = 0;
String name = "LINGGAR ELANG PRATAMA";
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
}
void calc() {
lcd.setCursor(0, 0);
lcd.print("HITUNG : ");
lcd.setCursor(9, 0);
lcd.print(num++);
}
void runningText(int row, String msg, int totalColumn) {
for(int x = 0; x < totalColumn; x++) {
msg = " " + msg;
}
msg = msg + " ";
for(int position = 0; position < msg.length(); position++) {
lcd.setCursor(0, row);
lcd.print(msg.substring(position, position + totalColumn));
calc();
delay(1);
}
}
void loop() {
// put your main code here, to run repeatedly:
runningText(1, name, 16);
}