Hooking up Potentiometer to Servo
annamaria
Posts: 4
in BASIC Stamp
Im trying to write a bit of code where I can control a servo with a potentiometer. I want to be able to move it to any angular position +/- 80degrees from the centre position. I should then display this position to the screen as it rotates.
Does anyone have any idea where I can start with this? I literally have no idea how to get the potentiometer to interact with the servo. Any bit of code would help to get me started!
Thanks
Does anyone have any idea where I can start with this? I literally have no idea how to get the potentiometer to interact with the servo. Any bit of code would help to get me started!
Thanks
Comments
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
PAUSE 1000
DO
HIGH 7
PAUSE 10
RCTIME 7,1, time
time= time */ 185 'scale by 0.724 x 256
time= time + 500 'offset by 500
PULSOUT 14, time 'send pulse to servo
DEBUG HOME, DEC5 time 'display time value
LOOP
Well this is the code I have that lets the servo turn to its full capacity both ways. I need to limit it to -/+ 80 degrees and display that value to the screen. That is the part I am stuck on
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
PAUSE 1000
DO
HIGH 7
PAUSE 10
RCTIME 7,1, time
time= time */ 185 'scale by 0.724 x 256
time= time + 500 'offset by 500
PULSOUT 14, time 'send pulse to servo
DEBUG HOME, DEC5 time 'display time value
LOOP
Well this is the code I have that lets the servo turn to its full capacity both ways. I need to limit it to -/+ 80 degrees and display that value to the screen. That is the part I am stuck on
OR: read carefully where they talk about calculating the multiplier (185) and adjust it.