/* * This code is for three servos to totate them to 90 then rotate them to the angle 0. * This code done by Eidha Alrashdi in FAbacaemy2018 * 6/1/2018 * */ #include // include servo library Servo myservo1;// define the first servo Servo myservo2;//define the second servo Servo myservo3;//define the third servo int servo1 = 3;// indicate servo 1 pin 3 int servo2 = 5;// second servo in pin 5 int servo3 = 6;//third servo in pin 6 void setup() { myservo1.attach(servo1);// atach servo to the servo in pin 3. myservo2.attach(servo2); myservo3.attach(servo3); myservo1.write(0);//I put this to make sure they go first to angle 0. myservo2.write(0);//I put this to make sure they go first to angle 0. myservo3.write(0); //I put this to make sure they go first to angle 0. } void loop() { myservo1.write(90);//here servo 1 will go to angle 90 delay(1000);// then it will wait 1second myservo2.write(90);// after 1 second servo 2 will follow it to 90 delay(1000); myservo3.write(90);// after that servo three will follow them to 90 delay(1000); myservo1.write(0);// servo 1 will return to servo 0 delay(1000); myservo2.write(0);// then servo two will go back to angle 0 delay(1000); myservo3.write(0);//then servo three will go back to angle 0 delay(1000);// wait for 1 seconfd then do the loop again }