Include Servo
Include Servo
h>
void setup() {
myservo.attach(9, 500, 2500); // Attach the servo to pin 9 with optional pulse
width limits
myservo.write(0); // Start at 0 degrees
delay(1000); // Wait for a second
}
void loop() {
// Sweep the servo from 0 to 180 degrees
for (int pos = 0; pos <= 180; pos++) {
myservo.write(pos); // Move to position
delay(15); // Wait for 15 milliseconds
}