#define LDR 2
#define LED 13
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 nilaiLDR = digitalRead(LDR);
if(nilaiLDR== 1) {
digitalWrite(LED, HIGH) ;
} else {
digitalWrite(LED, LOW);
}
delay(100);
}