#include <Servo.h> // Include the Servo library
Servo myServo; // Create a Servo object
int servoPin = 9; // Define the pin connected to the servo signal
void setup() {
myServo.attach(servoPin); // Attach the servo to the defined pin
}
void loop() {
// Rotate the servo to 0 degrees
myServo.write(0);
delay(1000); // Wait for a second
// Rotate the servo to 90 degrees
myServo.write(90);
delay(1000); // Wait for a second
// Rotate the servo to 180 degrees
myServo.write(180);
delay(1000); // Wait for a second
myServo.write(90);
delay(1000); // Wait for a second
}