|Macro functions and Motor precision/timing
|Page 1 of 1|
|Author:||Warhawk [ Fri Jan 15, 2010 9:08 pm ]|
|Post subject:||Macro functions and Motor precision/timing|
I would like to be able to create a code that allows my robot to perform multiple actions with the click of a single button. Along with that, i would like for my motors to be able to turn a specified amount during the command. I originally started with something along the lines of this:
but to my surprise when i pressed the button, the length of the spin was actually determined by the time I held down the button and was extremely inconsistant. If i pressed like normal the motor would spin for x long, but if i pressed it unrealisticly fast it would spin for x-y long...
I figured this was because the computer was executing the commands faster than i could move my finger, so the code was actually executing more than once. To combat this, i added:
I hoped, in vain, that the extra wait1msec would give the user time to press and release the button, but the effect was actually far more different... Instead the motor continued to spin the extra 100 milliseconds...
Is there a way to make the motor spin a certain amount in a given time with the use of a single button? Or better yet, do the HiTechnic DC motors have encoders i can use to specify the degree of the turn? (I know the servos do, but one of my senior club members told me the DC motors did not)
Thank you in advance!
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group