const int LDR = 4;
const int LED = 5;
int input_val = 0;
void setup() {
Serial.begin(9600);
pinMode(LED, OUTPUT);
}
void loop() {
input_val = analogRead(LDR);
Serial.print("LDR value is: ");
Serial.println(input_val);
delay(1000);
if (input_val < 800) { // Inverted condition for darkness
digitalWrite(LED, HIGH);
delay(5000);
} else {
digitalWrite(LED, LOW);
delay(1000);
}
}