// Sketch from: https://www.instructables.com/Arduino-LCD-Display-FlyIn-Text-Effect/
// Diagram from: https://wokwi.com/projects/294342288335700490
// Code adjusted for other pins to the display.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
// define variables
int startPoint;
int endPoint;
int i, j;
// speed of the text movement
int speed = 50;
// text to display
String txtMsg = "entropy";
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
}
void loop() {
startPoint = 0; //set starting point
endPoint = 12; //set ending point
lcd.clear();
//for each letter of the string starting from the last one.
for (i = txtMsg.length() - 1; i >= 0; i--)
{
startPoint = 0;
//for each position on the LCD display
for (j = 0; j < endPoint; j++)
{
lcd.setCursor(startPoint, 0);
lcd.print(txtMsg[i]);
delay(speed);
if (startPoint != endPoint - 1) {
lcd.setCursor(startPoint, 0);
lcd.print(' ');
}
startPoint++;
}
endPoint--;
delay(speed);
}
// hold the string on the display for 2 sec.
delay(2000);
}