Please help with SERVOS
Pedro Zepeda
Posts: 3
This is the program
Please I need to know how I can move the servo accurately and stay in the same position each time that I run the program again, because it is changing each time that I run the program. I want to move forward and backward 45 degrees each time. Thank you.
'{$STAMP BS2}
'{$PBASIC 2.5}
'I already center the cervo
x VAR Word
i VAR Word
FOR x=1 TO 3
FOR i=1TO 6
PULSOUT 12,850
PAUSE 100
NEXT
FOR i=1TO 6
PULSOUT 12,650
PAUSE 100
NEXT
NEXT
Please I need to know how I can move the servo accurately and stay in the same position each time that I run the program again, because it is changing each time that I run the program. I want to move forward and backward 45 degrees each time. Thank you.
'{$STAMP BS2}
'{$PBASIC 2.5}
'I already center the cervo
x VAR Word
i VAR Word
FOR x=1 TO 3
FOR i=1TO 6
PULSOUT 12,850
PAUSE 100
NEXT
FOR i=1TO 6
PULSOUT 12,650
PAUSE 100
NEXT
NEXT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
John is correct as far as "Hobby servos are not particularly accurate".
However I noticed in your code that you are pausing for 100mS.
Hobby servos are happy if they get a break anywhere from 15mS to 30mS.
Try changing your PAUSE value to 20mS and increase the for next loop in both
cases so that it reads...
FOR i=1 TO 30
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
FOR i=1TO 10
PULSOUT 12,850
PAUSE 20
NEXT
FOR i=1TO 10
PULSOUT 12,650
PAUSE 20
NEXT
NEXT
PULSOUT 12,735
'This pulsout at the end correct the mistake and make the process 99% accurate.
' Thank you.
You may or may not have to higher than 40 since you're going from one extreme to the other.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com