#include <Servo.h>
Servo myServo; // Create a servo object
void setup() {
myServo.attach(9); // Attach the servo to pin 9
}
void loop() {
myServo.write(30); // Rotate to 30 degrees
delay(1000); // Wait for a second
myServo.write(60); // Rotate to 60 degrees
delay(1000); // Wait for a second
myServo.write(90); // Rotate to 90 degrees
delay(1000); // Wait for a second
myServo.write(120); // Rotate to 120 degrees
delay(1000); // Wait for a second
myServo.write(180); // Rotate to 180 degrees
delay(1000); // Wait for a second
}
No comments:
Post a Comment