#include <ESP32Servo.h>
Servo myServo;
int buttonPin = 12;
int servoPin = 13;
int buttonState = 0;
void setup () {
pinMode(buttonPin, INPUT_PULLUP);
myServo.attach(servoPin);
myServo.write(0);
}
void loop() {
// Membaca status tombol
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
myServo.write(90);
} else {
myServo.write(0);
}
delay(50);
}