#define sensor 13
#define led 2
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(sensor, INPUT);
pinMode(led, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int data = digitalRead(sensor);
if (data == LOW) {
Serial.println("Light is present...");
digitalWrite(led, LOW);
}
else{
Serial.println("Light is not present....");
digitalWrite(led, HIGH);
}
delay(1000); // this speeds up the simulation
}