#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the address for the I2C LCD
#define I2C_ADDR 0x27
// Set the number of columns and rows in the LCD
#define LCD_COLUMNS 16
#define LCD_ROWS 2
// Create an instance of the LiquidCrystal_I2C library
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_ROWS);
// Define the text to scroll
const char scrollingText[] = "Hello World";
void setup() {
// Initialize the LCD
lcd.init();
// Turn on the backlight (if available)
lcd.backlight();
// Print the text on the LCD
lcd.print(scrollingText);
}
void loop() {
// Scroll the text
for (int i = 0; i < sizeof(scrollingText) - LCD_COLUMNS + 1; i++) {
lcd.scrollDisplayLeft();
delay(300); // Adjust the delay to control the scrolling speed
}
}