Project Name: Basic Servo

Aim of the project:  How to Program a Servo With Arduino

Component:

  • Arduino
  • Servo
  • Jumper Wire

Circuit Diagram:

Code:

#include <servo.h>
int servoPin=3;
Servo Servo1;
void setup(){
Servo1.attach(servoPin);
}
void loop(){
Servo1.write(0);
delay(2000);
Servo1.write(45);
delay(1000);
Servo1.write(90);
delay(1000);
Servo1.write(180);
delay(1000);
}

Runs Steps: