1// Include the Servo library #include <Servo.h>
2// Declare the Servo pin
3int servoPin = 3;
4// Create a servo object
5Servo Servo1;
6void setup() {
7 // We need to attach the servo to the used pin number
8 Servo1.attach(servoPin);
9}
10void loop(){
11 // Make servo go to 0 degrees
12 Servo1.write(0);
13 delay(1000);
14 // Make servo go to 90 degrees
15 Servo1.write(90);
16 delay(1000);
17 // Make servo go to 180 degrees
18 Servo1.write(180);
19 delay(1000);
20}