The University of Faisalabad: Experiment No.10
The University of Faisalabad: Experiment No.10
Faisalabad
Experiment No.10
To interfacing Servo Motor With Arduino Uno R3.
Softwares Used:
1. Proteus professional 8.1
2. Arduino Software
3. Microsoft Word
Procedure:
First of all I open the Arduino software.Then I write a program for servo
motor and verify the code that I wrote.Screen shoot is attached below.
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo
object
}
void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to
180 degrees
{
// in steps of 1 degree
myservo.write(pos);
// tell servo to go to position in
variable 'pos'
delay(15);
// waits 15ms for the servo to reach
the position
}
for(pos = 180; pos>=1; pos-=1)
// goes from 180 degrees
to 0 degrees
{
myservo.write(pos);
// tell servo to go to position in
variable 'pos'
delay(15);
// waits 15ms for the servo to reach
the position
}
}
3- In this step I open Proteus and select all components used. I select
Arduino and Servo motor. Now I connect these components. The screen
shoot is attached below.
Step 4:
Now I play the Proteus simulation. And it shows the results here the
screen shoot of running project is attached below.