Components Used:
Arduino UNO
Servo Motor
Jumper wires
Theory
Servo Motor : A Servo motor is a rotary actuator or motor that allows for a precise control in terms of angular position,acceleration and velocity,capabilities that a regular motor does not have.It makes use of a regular motor and pairs it with a sensor for position feedback.
![](https://static.wixstatic.com/media/a27d24_3ba7235e2e6e4edd98ee079be62a12d3~mv2.jpg/v1/fill/w_500,h_375,al_c,q_80,enc_auto/a27d24_3ba7235e2e6e4edd98ee079be62a12d3~mv2.jpg)
Connections:
![](https://static.wixstatic.com/media/a27d24_353fc7941bfc406582512c0250b08d2f~mv2.jpg/v1/fill/w_980,h_565,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/a27d24_353fc7941bfc406582512c0250b08d2f~mv2.jpg)
Code :
// Include the Servo library #include <Servo.h> // Declare the Servo pin int servoPin = 3; // Create a servo object Servo Servo1; void setup() { // We need to attach the servo to the used pin number Servo1.attach(servoPin); } void loop(){ // Make servo go to 0 degrees Servo1.write(0); delay(1000); // Make servo go to 90 degrees Servo1.write(90); delay(1000); // Make servo go to 180 degrees Servo1.write(180); delay(1000); }
//Any Issue feel free to comment