#define ldr 15
#define led 02
void setup() {
// put your setup code here, to run once:
pinMode(led, OUTPUT);
Serial.begin(115200);
Serial.println("Hello, ESP32!");
}
void loop() {
// put your main code here, to run repeatedly:
int ldrValue = analogRead(ldr);
Serial.print("nilai ldr = ");
Serial.println(ldrValue);
if (ldrValue < 700) {
digitalWrite(led, HIGH);
}
else {
digitalWrite(led, LOW);
}
delay(1000); // this speeds up the simulation
}