void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(12, INPUT);
pinMode(18, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int light=analogRead(12);
Serial.println("THE LIGHT INTENSITY IS :");
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");
}
}