// Sweep Continous Servo // This example code is in the public domain. // LRM - F.Osório 2012 #include Servo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { // Servo control: 0 degrees = Left Turn; 90 degrees = Stop; 180 degrees = Right Turn // Servo adjust: firstly adjust lateral knob in order to set 90 degrees to STOP position myservo.write(0); // tell servo to go one direction delay(5000); // waits 5000ms (5 sec) with the servo moving myservo.write(90); // tell servo to STOP delay(5000); // waits 5000ms (5 sec) with the servo stopped myservo.write(180); // tell servo to go in the other direction delay(5000); // waits 5000ms (5 sec) with the servo moving }