Servo Delay - How can I remove the delay between positions?
SN96
Posts: 318
Hello all
I'm trying to expand my knowledge on how to program the basic stamp since completing the "What's a microcontroller?" book. I have the Home work board, and I am trying to make my servo move from one position to another with out any delay. The problem I am having with the code below, is the servo does move to different locations·about as fast as I can get it, but when I hold the servo in my hand, I can feel the servo humming when it reaches each position and holds·for·a half second.
I understand you need to use pause 20 to give a 2.0ms delay between pulses, but what If I want instant response from one position to another? Would I need a PSC to do this?
·
I appreciate any help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
"Don't always think outside the box, sometimes thinking inside the box is more pratical and simple."
·
I'm trying to expand my knowledge on how to program the basic stamp since completing the "What's a microcontroller?" book. I have the Home work board, and I am trying to make my servo move from one position to another with out any delay. The problem I am having with the code below, is the servo does move to different locations·about as fast as I can get it, but when I hold the servo in my hand, I can feel the servo humming when it reaches each position and holds·for·a half second.
' {$STAMP BS2} ' {$PBASIC 2.5} counter VAR Word DO FOR counter = 1 TO 150 PULSOUT 14, 750 PAUSE 1 NEXT FOR counter = 1 TO 150 PULSOUT 14, 500 PAUSE 1 NEXT LOOP
I understand you need to use pause 20 to give a 2.0ms delay between pulses, but what If I want instant response from one position to another? Would I need a PSC to do this?
·
I appreciate any help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
"Don't always think outside the box, sometimes thinking inside the box is more pratical and simple."
·
Comments
·· The PAUSE 20 doesn't affect the rotational speed of the servo, especially if you suddenly send it a different number.· You're refreshing of the servo is going to ensure that it makes it to it's new destination.· On the other hand, you have a PAUSE 1, which will simply make most servos stutter while moving, and can actually make it move slower.
·· There is an easier way if you're going from one fixed position to another, rather than stepping through each iteration of the loop counter, as you are in your example.· For starters, one way to increase the speed would be to put the PAUSE back to 20, and STEP the count value by 5 or 10.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
As usual, you guys are always awsome! I was able to get my problem solved before you replied·by changing the step values. I appreciate your help / reply,·becuse it only confirms what I am doing is correct.
Here is the code that is running on my desk at this very moment:
It is working very smooth, as soon as the servo reaches one position, it istantly moves to the othe position, just as I wanted.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
"Don't always think outside the box, sometimes thinking inside the box is more pratical and simple."
·