Then I have created a servo object and declared the initial angle of the servo motor.First of all I have inserted the library for servo motor.Serial.println("Motor has started its rotation from 180 to 0 degress") Myservo.write(ang) // rotates the servo to rotate at specific angle Myservo.attach(8) // servo motor is attached to pin no 8 og Arduinoįor (ang = 0 ang = 0 ang -= 5) // goes from 180 degrees to 0 degrees with a step of 5 degree Int ang = 0 // a variable to store the servo angle Servo myservo // servo motor object for its control By uploading the source code to your Arduino board you will be able to control the servo motor using Arduino.You have to just copy the code given below and to past it in your Arduino software.The complete Arduino source code for Servo Motor Control using Arduino is given below.Yellow wire is basically the wire used to control the angular motion as well as the angle of the servo motor.The black wire is the attached to the GND pin of the Arduino UNO.I have supplied 5V to red wire of the servo motor as shown in the above figure.The circuit diagram for Servo Motor Control using Arduino is shown in the figure below.Jumper wires are shown in the figure below. Jumper Wires are used to make the connections of the all the components in order to make the complete circuit with proper working. Power of 5V is supplied to the servo motor from the Arduino UNO board. The selected servo motor is shown in the figure below. Servo Motor having torque of 2.5kgf-cm and 4.8-6.0v is used for this project. Arduino UNO board is shown in the figure below. It sends the servo encoded signal to the servo motor to control its angular movement.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |