lunt i an laboratory 6
TRANSCRIPT
-
8/12/2019 Lunt i an Laboratory 6
1/9
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
0 Tweet 0
Search
topics
android app
arduino
code
do it yourself
0Like Share
Arduino Tutorial Series Running A
Servo Motor Without A Library
Posted on January 10, 2013byadmin
...
Home Arduino Tutorials About Me
http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2F&text=Arduino%20Tutorial%20Series%20%E2%80%93%20Running%20A%20Servo%20Motor%20Without%20A%20Library%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2Fhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2F&text=Arduino%20Tutorial%20Series%20%E2%80%93%20Running%20A%20Servo%20Motor%20Without%20A%20Library%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2Fhttp://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2F&text=Arduino%20Tutorial%20Series%20%E2%80%93%20Running%20A%20Servo%20Motor%20Without%20A%20Library%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2Fhttp://twitter.com/search?q=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2Fhttp://www.luntianlaboratory.com/category/android-app/http://www.luntianlaboratory.com/category/arduino/http://www.luntianlaboratory.com/category/code/http://www.luntianlaboratory.com/category/diy/http://www.luntianlaboratory.com/arduino/no-library-servo/http://www.luntianlaboratory.com/author/admin/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/arduino-tutorials/http://www.luntianlaboratory.com/about/ -
8/12/2019 Lunt i an Laboratory 6
2/9
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Extra
gadgets
hacking gadgets
just looking
my projects
Software
recent art ic les
Western Digital My Passport
1TB
Intel RST for Cooler Platform
Controller Hub (PCH)
I Installed a Lincensed ESET
NOD32 Antivirus!
The Tale of Impulsive Upgrader |
From Windows.3x to Windows 8
/ 8.1
Bluetooth File Transfer ProtocolVersion 2
Blocking The Globe Tattoo
Ghost Web Icon
A Laptop Cooling Pad Test
Yet another version of running a servo motor without using a
library. My first example have no speed control. This more
complex version provides user an option for controlling the
speed. However, increasing the speed is limited to servo motor
capacity. On the other hand, it can be set to a very slow mode,slower and even slower than one century.
The wiring.
http://www.luntianlaboratory.com/category/software/http://www.luntianlaboratory.com/category/projects/http://www.luntianlaboratory.com/category/byte/http://www.luntianlaboratory.com/category/hacking/http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/category/extra/http://www.luntianlaboratory.com/category/gadgets/http://www.luntianlaboratory.com/category/hacking/http://www.luntianlaboratory.com/category/byte/http://www.luntianlaboratory.com/category/projects/http://www.luntianlaboratory.com/category/software/http://www.luntianlaboratory.com/gadgets/western-digital-my-passport/http://www.luntianlaboratory.com/gadgets/intel-rst-cool-pch/http://www.luntianlaboratory.com/software/licensed-eset-nod32/http://www.luntianlaboratory.com/extra/from-windows-95-to-windows-8/http://www.luntianlaboratory.com/android-app/bftp-2-tutorial/http://www.luntianlaboratory.com/extra/globe-tattoo-ghost-icon/http://www.luntianlaboratory.com/gadgets/laptop-cooling-pad/http://www.luntianlaboratory.com/arduino/no-library-servo/attachment/arduino-uno-wired-to-servo-motor/ -
8/12/2019 Lunt i an Laboratory 6
3/9
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
recent comments
admin on The Huawei Mobile
Pocket Wifi E5220
Mielon The Huawei M obile
Pocket Wifi E5220
Mielon The Huawei M obile
Pocket Wifi E5220
anne on The Huawei Mobile
Pocket Wifi E5220
tan on Fixing the Slow Arduino
IDE | More Than 20 SecondsDelay
tags
android
arduinobatterycameracomputerddwrtelectricityepsonfanfreedom
planglobehard diskhard
drivehuaweiinternet
The sketch.
// attach red wire to 5 volts
// attach black wire to ground
// attach the yellow wire pin 8
const byte servopin = 8;
// to variables the will make the
// servo turn to zero degree every
// restart/reset
int currentPosition = 500;
int commandPosition = 500;
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/gadgets/huawei-e5220-pocket-wifi/#comment-2836http://bestwifisecurity./http://www.luntianlaboratory.com/gadgets/huawei-e5220-pocket-wifi/#comment-2835http://bestwifisecurity./http://www.luntianlaboratory.com/gadgets/huawei-e5220-pocket-wifi/#comment-2834http://www.luntianlaboratory.com/gadgets/huawei-e5220-pocket-wifi/#comment-2833http://www.luntianlaboratory.com/arduino/slow-arduino-ide-fix/#comment-2832http://www.luntianlaboratory.com/tag/android/http://www.luntianlaboratory.com/tag/arduino/http://www.luntianlaboratory.com/tag/battery/http://www.luntianlaboratory.com/tag/camera/http://www.luntianlaboratory.com/tag/computer/http://www.luntianlaboratory.com/tag/ddwrt/http://www.luntianlaboratory.com/tag/electricity/http://www.luntianlaboratory.com/tag/epson/http://www.luntianlaboratory.com/tag/fan/http://www.luntianlaboratory.com/tag/freedom-plan/http://www.luntianlaboratory.com/tag/globe/http://www.luntianlaboratory.com/tag/hard-disk/http://www.luntianlaboratory.com/tag/hard-drive/http://www.luntianlaboratory.com/tag/huawei/http://www.luntianlaboratory.com/tag/internet/http://www.luntianlaboratory.com/arduino/no-library-servo/attachment/wiring-servo-motor-to-arduino-board/ -
8/12/2019 Lunt i an Laboratory 6
4/9
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
laptoplcdldrledledslinux
mmorpgmotormp3phone
potentiometerpower supplypsu
push buttonqosroutersamsung
sd cardseven segmentssmartsony
stepper motorsun cellular
tattootoshibausbwifi
windowswirewordpress
// larger rotateSpeed value means
// slower and smaller value means
// faster
byte rotateSpeed = 1;
// changing the increment value
// will also change the servo speed
// larger value increases speed
// lower value lowers speed
int increment = 2;
void setup(){ //void setup start
Serial.begin(9600);
pinMode(servopin,OUTPUT);
}// void setup end
void rotate(){//void rotate start
/******************************************
Use the variable currentPosition to
turn the servo motor
The next four lines of codes are the basicto run the servo motor. The delayMicroseconds
can hold value from 500(0 degrees) to
2500(180 degrees)
******************************************/
digitalWrite(servopin,HIGH);
delayMicroseconds(currentPosition);
digitalWrite(servopin,LOW);
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/tag/laptop/http://www.luntianlaboratory.com/tag/lcd/http://www.luntianlaboratory.com/tag/ldr/http://www.luntianlaboratory.com/tag/led/http://www.luntianlaboratory.com/tag/leds/http://www.luntianlaboratory.com/tag/linux/http://www.luntianlaboratory.com/tag/mmorpg/http://www.luntianlaboratory.com/tag/motor/http://www.luntianlaboratory.com/tag/mp3/http://www.luntianlaboratory.com/tag/phone/http://www.luntianlaboratory.com/tag/potentiometer/http://www.luntianlaboratory.com/tag/power-supply/http://www.luntianlaboratory.com/tag/psu/http://www.luntianlaboratory.com/tag/push-button/http://www.luntianlaboratory.com/tag/qos/http://www.luntianlaboratory.com/tag/router/http://www.luntianlaboratory.com/tag/samsung/http://www.luntianlaboratory.com/tag/sd-card/http://www.luntianlaboratory.com/tag/seven-segments/http://www.luntianlaboratory.com/tag/smart/http://www.luntianlaboratory.com/tag/sony/http://www.luntianlaboratory.com/tag/stepper-motor/http://www.luntianlaboratory.com/tag/sun-cellular/http://www.luntianlaboratory.com/tag/tattoo/http://www.luntianlaboratory.com/tag/toshiba/http://www.luntianlaboratory.com/tag/usb/http://www.luntianlaboratory.com/tag/wifi/http://www.luntianlaboratory.com/tag/windows/http://www.luntianlaboratory.com/tag/wire/http://www.luntianlaboratory.com/tag/wordpress/ -
8/12/2019 Lunt i an Laboratory 6
5/9
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
delayMicroseconds(20);
}//void rotate end
void loop(){// void loop start
/******************************************
Set of command to assign value to variable
commandPosition. Open the serial monitor and
letter a,b,c,d,e consecutively.
The commandPosition variable can be assigned
with any value from analog sensor such as
temperature and potentiometer.
******************************************/
if (Serial.available() > 0) { //if serial avail
int data = Serial.read();
if (data =='a'){
commandPosition = 500;
}
if (data =='b'){
commandPosition = 1000;
} if (data =='c'){
commandPosition = 1500;
}
if (data =='d'){
commandPosition = 2000;
}
if (data =='e'){
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
8/12/2019 Lunt i an Laboratory 6
6/9
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
commandPosition = 2500;
}
}// if serial.available end
/******************************************
Set of command to assign value from
commandPosition to currentPosition
******************************************/
if (commandPosition > currentPosition){
currentPosition = currentPosition + increment;
rotate();
}
if (commandPosition < currentPosition){
currentPosition = currentPosition - increment;
rotate();
}
if (commandPosition == currentPosition){
currentPosition = commandPosition;
digitalWrite(servopin,LOW); // stop sending pu
} // as soon as the desired position
// reached
// Rotation speeddelay(rotateSpeed);
}//void loop end
I realized I never posted a the first version after hitting the publish
button.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
8/12/2019 Lunt i an Laboratory 6
7/9
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
ONE THOUGHT ON ARDUINO TUTORIAL SERIES RUNNING A SERVO MOT OR
WITHOUT A LIBRARY
RELATED POSTS
1. Arduino Tutorial Series Running Epson Stepper Motor
EM-546
2. Arduino Tutorial Series The On-board Blinking LED
3. Arduino Tutorial Series The Millis-Based Delay4. Arduino Tutorial Series Running A Cheap 4-Digits Seven
Segments LED
...
0 Tweet 0
This entry was posted in arduinoand tagged arduino, servo motorby
admin. Bookmark the permalink.
0Like Share
Rod on September 1, 2013 at 2:22 amsaid:
Thank you so much for posting this. The standard Servo
library is not compatible with SoftwareSerial because of
issues with interrupts. Thats where going back to basics
is what gets the job done. Very simple code. I could
http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2F&text=Arduino%20Tutorial%20Series%20%E2%80%93%20Running%20A%20Servo%20Motor%20Without%20A%20Library%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2Fhttp://twitter.com/search?q=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fno-library-servo%2Fhttp://www.luntianlaboratory.com/hacking/epson-stepper-em-546/http://www.luntianlaboratory.com/arduino/on-board-blinking-led/http://www.luntianlaboratory.com/arduino/millis-delay-base/http://www.luntianlaboratory.com/arduino/4-digit-seven-segments/http://www.luntianlaboratory.com/category/arduino/http://www.luntianlaboratory.com/tag/arduino/http://www.luntianlaboratory.com/tag/servo-motor/http://www.luntianlaboratory.com/author/admin/http://www.luntianlaboratory.com/arduino/no-library-servo/ -
8/12/2019 Lunt i an Laboratory 6
8/9
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
customize it within minutes thanks to how well it is
commented. You definitely saved the day!
Reply
Leave a Reply
Your email address will not be published. Required fields are
marked *
Name *
Email
*
Website
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/arduino/no-library-servo/?replytocom=1688#respond -
8/12/2019 Lunt i an Laboratory 6
9/9
df di b PRO i A d l ? T t th HTML t PDF API
Using Slide Potentiometer With Arduino
Extending Brain Capacity With Voice Recorder
by luntianlaboratory.com 2010-2012see change log, site rules & stuff
posts with pictures of luntiancorner.com were moved articles. they are owned by the same author
Post Comment
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fno-library-servo%2f&id=ma-140326205144-f1ec8d1fhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/arduino/potentionmeter-arduino-slide/http://www.luntianlaboratory.com/gadgets/brain-voice-recorder/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/about/http://www.luntianlaboratory.com/about/