#include Servo servo1; void setup() { servo1.attach(9); // attaches the servo on pin 9 to the servo object pinMode(13, OUTPUT); pinMode(12, OUTPUT); } void loop() { int position; for(position = 90; position < 180; position += 2) { servo1.write(position); // Move to next position delay(20); // Short pause to allow it to move } digitalWrite(13, HIGH); digitalWrite(12, HIGH); delay(50); digitalWrite(13, LOW); digitalWrite(12, LOW); delay(50); digitalWrite(13, HIGH); digitalWrite(12, HIGH); delay(50); digitalWrite(13, LOW); digitalWrite(12, LOW); delay(50); digitalWrite(13, HIGH); digitalWrite(12, HIGH); delay(50); digitalWrite(13, LOW); digitalWrite(12, LOW); delay(50); digitalWrite(13, HIGH); digitalWrite(12, HIGH); delay(3000); digitalWrite(13, LOW); digitalWrite(12, LOW); delay(1000); for(position = 180; position >= 90; position -= 1) { servo1.write(position); // Move to next position delay(20); // Short pause to allow it to move } }