#include <ESP32Servo.h>
Servo myservo1;
const int pinLdr = 19;
int bacaSensorLDR;
void setup()
{
myservo1.attach(18);
pinMode(pinLdr, INPUT);
myservo1.write(60);
}
void loop()
{
bacaSensorLDR = digitalRead(pinLdr);
if (bacaSensorLDR == LOW)
{
myservo1.write(60);
delay(100);
}
else if (bacaSensorLDR == HIGH)
{
myservo1.write(150);
delay(100);
}
}