#include <ESP32Servo.h> // Include the ESP32Servo library
// Define the servo object
Servo myServo;
// Define the servo pin (GPIO 26)
#define SERVO_PIN 26
void setup() {
Serial.begin(115200);
// Attach the servo to GPIO 26
myServo.attach(SERVO_PIN);
Serial.println("Servo Ready!");
}
void loop() {
// Move servo to 90 degrees
myServo.write(90);
Serial.println("Servo at 90°");
delay(100);
// Move servo to 180 degrees
myServo.write(180);
Serial.println("Servo at 180°");
delay(100);
}