|Smooth dynammic servo motion
|Page 1 of 1|
|Author:||magicode [ Sun Nov 07, 2010 7:20 pm ]|
|Post subject:||Smooth dynammic servo motion|
Our robot requires servos to move smoothly based on user input whithout interrupting any other functions. I wrote this code, and felt that maybe beginner programmers would benifit from it. Also, if anybody has a way to make this more efficient (without using multitasking, because this is for beginner programmers) please let me know.
We wanted to move the servo up if button 6U is pressed, and down if button 6D is pressed. This is more complicated than it sounds, because if you do this:
then the servo will go fully up as soon as you press the button, because the microprocessor cycles through the loop hundreds of times while you are holding the button.
now if we do this:
then the other controls get interrupted while the program is waiting, and time sensetive functions get messed up.
My solution was to use timers like this:
That's it. Comment if you have questions or see a problem. Thanks.
|Author:||jbflot [ Mon Nov 08, 2010 10:04 am ]|
|Post subject:||Re: Smooth dynammic servo motion|
Clever! Thanks for sharing your solution.
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group