//LIBRARY : LiquidCrystal I2C
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Change address to 0x27 or 0x3F depending on your LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);
int counter = 0;
void setup() {
lcd.init(); // Initialize LCD
lcd.backlight(); // Turn on backlight
lcd.setCursor(0, 0);
lcd.print("I2C LCD Demo");
delay(1000); // Pause before starting loop
}
void loop() {
lcd.setCursor(0, 1); // Row 1 (second line)
lcd.print("Count: ");
lcd.print(counter); // Display the counter value
lcd.print(" "); // Clear any old digits
counter++; // Increment counter
delay(1000); // Update every 1 second
}
// LCD - LIQUID CRYSTAL
// GND - GROUND PIN (ANY)
// VCC - EITHER 3.3V OR 5V
// SDA - A4 ANALOG PIN (FIXED)
// SCL - A5 ANALOG PIN (FIXED)