#define THRESHOLD 2045
const int LDR_PIN = 2;
void setup() {
Serial.begin(115200);
pinMode(LDR_PIN , INPUT);
}
void loop() {
int ldrValue = analogRead(LDR_PIN);
Serial.println("Ldr Value = ");
Serial.print(ldrValue);
if(ldrValue<THRESHOLD){
Serial.println("Light!");
}else {
Serial.println("Dark!");
}
delay(1000); // this speeds up the simulation
}