#include <Wire.h>//Enables I2C communication for connecting the LCD to the ESP32
#include <LiquidCrystal_I2C.h>//Provides functions for controlling the I2C LCD display.
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set LCD address
const char* messages[] = {
"Welcome!",
"ESP32 Rocks!",
"Arrays are Cool!",
"Coding is Fun!",
"Wokwi Rocks!"
};
int msgIndex = 0;
const int totalMessages = sizeof(messages) / sizeof(messages[0]);
void setup() {
lcd.init();
lcd.backlight();
}
void loop() {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Message:");
lcd.setCursor(0, 1);
lcd.print(messages[msgIndex]);
msgIndex = (msgIndex + 1) % totalMessages; // Loop through messages
delay(2000); // Wait for 2 seconds
}