#include <Wire.h> // Include the Wire library for I2C
#include <LiquidCrystal_I2C.h> // Include the LCD I2C library
// Create two LCD objects with different I2C addresses and the same dimensions (16x2)
LiquidCrystal_I2C lcd1(0x27, 16, 2); // LCD 1 with address 0x27
LiquidCrystal_I2C lcd2(0x3F, 16, 2); // LCD 2 with address 0x3F
void setup() {
// Start the serial communication for debugging
Serial.begin(115200);
// Initialize both LCDs
lcd1.init();
lcd2.init();
// Turn on the backlight for both LCDs
lcd1.backlight();
lcd2.backlight();
// Clear both LCDs
lcd1.clear();
lcd2.clear();
// Display messages on both LCDs
lcd1.setCursor(0, 0); // Set cursor to first row, first column on lcd1
lcd1.print("Hello, LCD 1!");
lcd2.setCursor(0, 0); // Set cursor to first row, first column on lcd2
lcd2.print("Hello, LCD 2!");
// Print a message to Serial Monitor for debugging
Serial.println("Two LCDs initialized.");
}
void loop() {
// Nothing to do here
delay(1000); // Optional delay
}