#include <LiquidCrystal_I2C.h>
const int LED = 12;
const int LDR_PIN = A0; // Change the pin according to your LDR connection
int ldrValue;
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
pinMode(LED, OUTPUT);
pinMode(LDR_PIN, INPUT);
lcd.init();
lcd.backlight();
}
void loop() {
ldrValue = analogRead(LDR_PIN);
lcd.setCursor(2, 0);
lcd.print("Room: ");
if (ldrValue > 100) {
digitalWrite(LED, HIGH); // Turn on the LED if it's night
lcd.print("Dark");
} else {
digitalWrite(LED, LOW); // Turn off the LED if it's day
lcd.print("Day ");
}
delay(100);
}