#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16x2 LCD with an I2C interface.
// Adjust according to your LCD's actual address.
#define I2C_ADDR 0x27
// Define the dimensions of your LCD (e.g., 16 columns and 2 rows)
#define LCD_COLUMNS 16
#define LCD_ROWS 2
// LED pin
#define LED_PIN 13
// Create an instance of the LiquidCrystal_I2C library
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_ROWS);
void setup() {
// Initialize the I2C communication
Wire.begin();
// Initialize the LCD
lcd.init();
// Turn on the backlight (if applicable)
lcd.backlight();
// Set up the text display
lcd.clear();
pinMode(LED_PIN, OUTPUT);
}
void loop() {
// Display "LED is OFF"
lcd.setCursor(0, 0);
lcd.print("LED is OFF ");
delay(1000);
// Display "LED is ON"
lcd.clear(); // Clear the screen
lcd.setCursor(0, 0);
lcd.print("LED is ON ");
delay(1000);
// Your other code here, if any
}