#define THRESHOLD 2045
const int LDR_PIN = 2;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(LDR_PIN, INPUT);
}
void loop() {
int ldrValue = analogRead(LDR_PIN);
Serial.print("LDR value =");
Serial.println(ldrValue);
if(ldrValue > THRESHOLD) {
Serial.println("Dark!");
} else {
Serial.println("Light!");
}
delay(10); // this speeds up the simulation
}