#include <ESP32Servo.h>
int pos = 0; // variable to store the servo position
Servo myservo; // create servo object to control a servo
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(25, OUTPUT);
pinMode(18, INPUT);
myservo.attach(33);
}
void loop() {
// put your main code here, to run repeatedly:
servo.write(180);
int button = digitalRead(18);
if (button==LOW){
digitalWrite(25, HIGH);
}
else{
digitalWrite(25, LOW);
}
}