const int LDR = 14;
const int LED1 = 27; // First LED
const int LED2 = 13; // Second LED
int input_val = 0;
void setup() {
Serial.begin(9600);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT); // Set the second LED pin as an OUTPUT
}
void loop() {
input_val = analogRead(LDR);
Serial.print("LDR value is: ");
Serial.println(input_val);
delay(1000);
// Control the first LED
if (input_val > 800) {
digitalWrite(LED1, HIGH);
delay(1000);
} else {
digitalWrite(LED1, LOW);
delay(1000);
}
// Control the second LED (same function as the first LED)
if (input_val > 800) {
digitalWrite(LED2, HIGH);
delay(1000);
} else {
digitalWrite(LED2, LOW);
delay(1000);
}
}