void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(14, INPUT);
pinMode(18, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int light= analogRead(14);
Serial.println(light);
delay(1000); // this speeds up the simulation
if (light>1000) {
digitalWrite(18, HIGH);
Serial.println(("light on"));
}
else {digitalWrite(18, LOW);
Serial.println(("light off"));}
}