int ldr = 35;
int led = 15;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(ldr, INPUT);
pinMode(led, OUTPUT);
}
void loop() {
int sensor = analogRead(ldr);
Serial.println(sensor);
if (sensor >= 500){
digitalWrite(led, HIGH);
}
if (sensor < 500){
digitalWrite(led, LOW);
}
delay(1000);
}