#include <Servo.h>
Servo myservo; // create servo object to control a servo
Servo myservo2;
// twelve servo objects can be created on most boards
int start_pos = 90; // variable to store the servo position
int end_pos =180
void setup() {
myservo.attach(3); // attaches the servo on pin 9 to the servo object
myservo2.attach(5);
}
void loop() {
for (pos = start_pos; pos <= final_pos; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
myservo2.write(pos);
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = final_pos; pos >= start_pos; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
myservo2.write(pos);
delay(15); // waits 15ms for the servo to reach the position
}
delay(5000);
}