Shop OBEX P1 Docs P2 Docs Learn Events
Controlling Servo Motor — Parallax Forums

Controlling Servo Motor

Joch119Joch119 Posts: 7
edited 2008-10-17 23:58 in BASIC Stamp
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

Comments

  • Lab RatLab Rat Posts: 289
    edited 2008-10-17 23:58
    i wish i could try that it sounds like fun but i dont have that stuff

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax posesses power beyond belief.

    Believe in it.
Sign In or Register to comment.