Arduino Tutorials – Lesson 4 – Sweep Servo Motor Control Using Arduino UNO

Creating servo motor program using Arduino UNO

Required Components

  1. Servo motor (5V) -1 no
  2. Arduino UNO board -1 no
  3. Connecting wires -1 set

Circuit

Steps

  1. Make sure the components are working properly.
  2. Connect Arduino board 5v and GND pin to the servo motor by using wires.
  3. Connect servo motor data pin to the Arduino UNO pin 9.
  4. Check the Arduino program.
  5. Check the circuit connections.
  6. Run the Arduino program.

Arduino Program

#include<Servo.h>
Servo servo1;

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

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

Usage

  1. Industrial robotics.
  2. CD/DVD players.
  3. Elevators.
  4. Rudders.
  5. Automated doors.

Projects

  1. Robot-Arm.
  2. Sensor dustbin.

Leave a Reply

Your email address will not be published. Required fields are marked *