#include <Servo.h>
Servo servo1; // create servo object to control a servo
Servo servo2; // create servo object to control a servo
Servo servo3;
Servo servo4;
int pos = 0; // variable to store the servo position
void setup() {
servo1.attach(9);
servo2.attach(10);
servo3.attach(11);
servo4.attach(12);
}
void loop() {
servo1.write(0); // tell servo to go to position in variable 'pos'
delay(150); // waits 15ms for the servo to reach the position
servo2.write(180); // tell servo to go to position in variable 'pos'
delay(150);
servo3.write(0); // tell servo to go to position in variable 'pos'
delay(150); // waits 15ms for the servo to reach the position
servo4.write(180); // tell servo to go to position in variable 'pos'
delay(150);
servo1.write(180); // tell servo to go to position in variable 'pos'
delay(150); // waits 15ms for the servo to reach the position
servo2.write(0); // tell servo to go to position in variable 'pos'
delay(150);
servo3.write(180); // tell servo to go to position in variable 'pos'
delay(150); // waits 15ms for the servo to reach the position
servo4.write(0); // tell servo to go to position in variable 'pos'
delay(150);
}