#include Servo myservo; void setup() { myservo.attach(9); //set up the servo as usual Serial.begin(9600); //for watching the speeds in the serial monitor } void loop() { // on this servo 1500 is stopped, above 1500 is clockwise, below is counter clockwise for (int i=1500; i >= 1300; i=i-20) //start from a stop and slowly increase to get the motor turning { myservo.writeMicroseconds(i); Serial.print("Running motor at: "); Serial.println(i, DEC); delay(5000); } for (int i=1300; i <= 1500; i=i+50) { myservo.writeMicroseconds(i); Serial.print("Running motor at: "); Serial.println(i, DEC); delay(5000); } delay(5000); //wait for five seconds and then spin it the other way, counting up again. for (int i=1500; i <= 1700; i=i+20) { myservo.writeMicroseconds(i); Serial.print("Running motor at: "); Serial.println(i, DEC); delay(5000); } }