#include <LiquidCrystal.h>
LiquidCrystal lcd(9, 8, 7, 6, 5, 4); // RS, E, D4, D5, D6, D7
const int backlightPin = 18;
void setup() {
lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows
lcd.setCursor(0, 0); // Set the cursor to the beginning of the first line
// Set the backlight pin as an output
pinMode(backlightPin, OUTPUT);
// Turn on the backlight
digitalWrite(backlightPin, HIGH);
}
void loop() {
// Set the initial position of the text
lcd.setCursor(0, 0);
// Your scrolling text
String text = "Hello, World! ";
// Loop through each character in the text
for (int i = 0; i < text.length(); ++i) {
lcd.clear(); // Clear the display
lcd.print(text.substring(i)); // Print the substring starting from position i
delay(500); // Adjust the delay to control the scrolling speed
}
}