int ldr_sensor = 35;
int led = 2;
void setup() {
Serial.begin(9600);
analogSetAttenuation(ADC_11db);
pinMode(led, OUTPUT);
}
void loop() {
int ldrvalue analogRead(ldr_sensor);
Serial.print ("Ldr Value");
Serial.print (ldrvalue);
if (ldrvalue < 40) (
Serial.println("=> Very Bright");
digitalWrite(led, LOW);
} else if (ldrvalue < 800) (
Serial.println(" => Bright");
digitalWrite(led, LOW);
} else if (Idrvalue < 2000) {
Serial.println(" => Light");
digitalWrite(led, LOW);
} else if (ldrvalue < 3200) [
Serial.println(" => Dim");
digitalWrite(led, HIGH);
} else {
Serial.println(" => Dark");
digitalWrite(led, HIGH);
}
delay (1000);
}