Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo myservo; // create Servo object to control a servo
- void setup() {
- myservo.attach(2); // attaches the servo on pin 2 to the Servo object
- myservo.write(90); // sets the servo position to midle 90
- }
- void loop() {
- myservo.write(0); // sets the servo position 0
- delay(1000); // waits 1s
- myservo.write(90); // sets the servo position 90
- delay(1000); // waits 1s
- myservo.write(180); // sets the servo position 180
- delay(1000); // waits 1s
- }
Advertisement
Add Comment
Please, Sign In to add comment