Standard rotation servo

Lets start with trying out a standard rotation servo. Connect it to D9.

To control the servos, we are going to use a library called Servo. A library is a piece of code that has already been written and that you can call upon whenever you need to use it. Instead of having to write all that code yourself, you just have to add this line of code#include <Servo.h> to the beginning of your program.

Write the following in the Arduino IDE:

#include <Servo.h>

Servo myservo;

void setup() {
myservo.attach(9);
}

void loop() {
myservo.write(0);
delay(1000);
myservo.write(180);
delay(1000);
}