int l1 = 11;
int l2 = 9;
int l3 = 5;
int l4 = 2;
int ldr = A0;
void setup() {
Serial.begin(9600);
pinMode(l1, OUTPUT);
pinMode(l2, OUTPUT);
pinMode(l3, OUTPUT);
pinMode(l4, OUTPUT);
pinMode(ldr, OUTPUT);
// put your setup code here, to run once:
}
void loop() {
int a = analogRead(ldr);
digitalWrite(ldr, HIGH);
if (a < 200)
{
digitalWrite(l1, HIGH);
digitalWrite(l2, LOW);
Serial.println("1st led on");
delay(1000);
}
else if ((a < 400) and (a>=201))
{
digitalWrite(l1, LOW);
digitalWrite(l2, HIGH);
Serial.println("2nd led on");
delay(1000);
}
// put your main code here, to run repeatedly:
}