Actually, we previously published Servo Motor Arduino Code for the Beginners but after publishing the guide Best Servo Motor for the Beginners we thought to somewhat rewrite the old guide with this new title Tower Pro SG 5010 Servo Motor Test Code for Arduino with proper sketch and video demo. You can read the former guide later after reading guide.
Tower Pro SG 5010 Servo Motor Test Code for Arduino
We already pointed on how to build a DIY robotic arm. We can fine tune the degrees of sweep, time to be taken and step by degree. We kept the below code in Github as Gist too as well as the whole stuff as Firtzing Project (recommended to check) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// coded by Dr. Abhishek Ghosh @AbhishekCTRL #include <Servo.h> Servo towerprosg5010; int pos = 0; void setup() { towerprosg5010.attach(9); } void loop() { for(pos = 0; pos < 180; pos += 1) // 0 to 180 degrees with 1 degree step { towerprosg5010.write(pos); delay(120); // time set 120 ms to reach sloooooowly } } |
#include
– that is Arduino specific. If you are advanced user you may read how to code in C for Arduino.
---
towerprosg5010
– need not to be explained, it is just a phrase, we could use thecustomizewindows
.
towerprosg5010.attach(9)
– we attached the servo motor pin 9. You can change it.
for(pos = 0; pos < 180; pos += 1)
- we are telling to sweep 0 to 180 degrees with 1 degree step
delay(120)
- if you lower it, the sweep will be faster.
The circuit is very easy. The servo motor will have the end with 3 holes which can easily accommodate the pin of a jumper wire. For this code, yellow will get connected to the pin 9 on Arduino UNO board, Brown will go to ground/GND and the red will go the 5v pin of Arduino board. This is becoming our kind infographics cum circuit diagram :

Video Demo of Tower Pro SG 5010 Servo Motor Test Code for Arduino
Definitely, we have a crap quality video! Crap quality is good because it will save the bandwidth and serve the purpose :
Tagged With 아두이노 sg5010 , tower pro sg5010 test code arduino , tower pro sg-5010 problems , tower pro sg 5010 test code , tower pro 5010 servo IDE code , test sg motor with the arduino , sg5010 arduino code , sg5010 arduino , sg-5010 arduino , sg 5010サーボHere’s what we’ve got for you which might like :
Additionally, performing a search on this website can help you. Also, we have YouTube Videos.
Take The Conversation Further ...
We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!
If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.
Contact Us