#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Initialize the LCD with I2C address 0x27
const int relay1Pin = 15; // GPIO pin for relay 1
const int relay2Pin = 2; // GPIO pin for relay 2
const int relay3Pin = 4; // GPIO pin for relay 3
void setup() {
lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows
lcd.print("Relay Control"); // Display a message on the LCD
delay(2000);
pinMode(relay1Pin, OUTPUT); // Set relay pins as OUTPUT
pinMode(relay2Pin, OUTPUT);
pinMode(relay3Pin, OUTPUT);
}
void loop() {
lcd.clear(); // Clear the LCD screen
lcd.setCursor(0, 0); // Set the cursor to the first column of the first row
lcd.print("Relay 1: ON"); // Display relay status on the LCD
digitalWrite(relay1Pin, HIGH); // Turn on relay 1
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Relay 1: OFF");
digitalWrite(relay1Pin, LOW); // Turn off relay 1
delay(2000);
}
// Repeat the same steps for relay 2 and relay 3
//