#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Adjust the address (0x27) if needed
void setup() {
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
lcd.setCursor(0, 0);
lcd.print("LDR Value:");
Serial.begin(9600);
}
void loop() {
int ldrValue = analogRead(A0); // Read value from LDR
lcd.setCursor(0, 1);
lcd.print("Value: ");
lcd.print(ldrValue); // Display LDR value on LCD
delay(500); // Update every 500ms
Serial.println(ldrValue); // Optional: Print to Serial Monitor
}