#include <LiquidCrystal.h>
// Pin configuration
const int rs = 12; // Register Select (RS)
const int en = 11; // Enable (EN)
const int d4 = 5; // Data 4 (D4)
const int d5 = 4; // Data 5 (D5)
const int d6 = 3; // Data 6 (D6)
const int d7 = 2; // Data 7 (D7)
// Create an LCD object
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
char name[] = "HELLO WORLD"; // Make sure to have enough spaces for smooth scrolling
void setup() {
// Set up the LCD's number of columns and rows
lcd.begin(20, 4); // Assuming a 20x4 LCD
}
void loop() {
// Scroll the name to the left on both the first and third rows
for (int i = 0; i < 20; i++) {
lcd.clear();
lcd.setCursor(i, 0);
lcd.print(name);
lcd.setCursor(i, 2); // Set cursor for the third row
lcd.print(name);
delay(300); // Adjust the delay for the scrolling speed
}
// Move the cursor to the starting position on both rows
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(name);
lcd.setCursor(0, 2); // Set cursor for the third row
lcd.print(name);
delay(1000); // Pause at the end before scrolling again
}