// Include the Servo library
#include <Servo.h>
// Define the pin for the servo motor
int servoPin = 9;
// Create a Servo object
Servo myservo;
void setup() {
// Attach the servo motor to its respective pin
myservo.attach(servoPin);
}
void loop() {
// Move the servo motor to the initial position
myservo.write(90);
delay(1000);
// Move the servo motor to the opposite position
myservo.write(0);
delay(1000);
}