#include <Wire.h> // Include the Wire library for I2C communication
#include <LiquidCrystal_I2C.h> // Include the LCD I2C library
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD address to 0x27 for a 16 chars and 2 line display
const int ledPin = 13; // Define the LED pin
void setup() {
pinMode(13, OUTPUT); // Set the LED pin as an output
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
}
void loop() {
digitalWrite(13, HIGH); // Turn on the LED
lcd.setCursor(0, 1); // Set cursor to the beginning of the second line
lcd.print("LED is On "); // Display "LED is On" on LCD
delay(2000); // Wait for 2 seconds
digitalWrite(13, LOW); // Turn off the LED
lcd.setCursor(0, 1); // Set cursor to the beginning of the second line
lcd.print("LED is Off "); // Display "LED is Off" on LCD
delay(2000); // Wait for 2 seconds
}