#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int ledPin1 = 2;
const int ledPin2 = 4;
const int ledPin3 = 13;
const int ledPin4 = 14;
const char* words[] = {
"Word1",
"Word2",
"Word3",
"Word4"
};
int numWords = sizeof(words) / sizeof(words[0]);
int currentWordIndex = 0;
unsigned long lastWordChangeTime = 0;
const long wordDisplayDuration = 1000;
void setup() {
lcd.init();
lcd.backlight();
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
}
void loop() {
unsigned long currentTime = millis();
if (currentTime - lastWordChangeTime >= wordDisplayDuration) {
lcd.clear();
lcd.setCursor(5, 1);
lcd.print(words[currentWordIndex]);
currentWordIndex = (currentWordIndex + 1) % numWords;
lastWordChangeTime = currentTime;
}
updateLEDs(currentWordIndex);
}
void updateLEDs(int index) {
digitalWrite(ledPin1, (index == 0) ? HIGH : LOW);
digitalWrite(ledPin2, (index == 1) ? HIGH : LOW);
digitalWrite(ledPin3, (index == 2) ? HIGH : LOW);
digitalWrite(ledPin4, (index == 3) ? HIGH : LOW);
}