Controlling Servo Motor
Joch119
Posts: 7
I have the BS2 with the Bluetooth module. I am trying to control the servo through the bluetooth connection. We wrote a basic program in PBASIC that used the SERIN command to accept a variable that controls the servo. A certain variable will make it STOP. The problem is that we cant make the servo STOP when its in a loop. We got it to some what work using the "Timeout" command in "SERIN" but it is very choppy. Is there a way to make the servo react to our input without being choppy?
Here is the code that I have so far:
bData VAR Byte
PAUSE 1000
Main:
SERIN 0,84,[noparse][[/noparse]STR bData\1]
DEBUG STR bData\1
IF (bData = "W") THEN
GOSUB Cam_UP
ENDIF
Cam_Up:
PULSOUT 12, 740
SERIN 0, 16780, 100, Cam_Up, [noparse][[/noparse]STR bData\1]
IF (bData = "M") THEN
PULSOUT 12, 750
GOTO Main
ENDIF
Here is the code that I have so far:
bData VAR Byte
PAUSE 1000
Main:
SERIN 0,84,[noparse][[/noparse]STR bData\1]
DEBUG STR bData\1
IF (bData = "W") THEN
GOSUB Cam_UP
ENDIF
Cam_Up:
PULSOUT 12, 740
SERIN 0, 16780, 100, Cam_Up, [noparse][[/noparse]STR bData\1]
IF (bData = "M") THEN
PULSOUT 12, 750
GOTO Main
ENDIF
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax posesses power beyond belief.
Believe in it.