Shop OBEX P1 Docs P2 Docs Learn Events
Remote Control Bot — Parallax Forums

Remote Control Bot

Wheelie016Wheelie016 Posts: 11
edited 2013-02-27 18:26 in BASIC Stamp
Hi All,

I am trying to build a functioning remote control bot; so far that functioning part isn't working so great. I'm using the Basic Stamp 2, two Xbee Wireless radio's(one connected to my computer), and a Pololu Serial Servo Controller. The goal, at least at first, was to have it move in the direction corresponding to the WAS & D keys on my keyboard, which would be sent through a terminal program, and to the receiving Xbee. Then the BS2 would send the appropriate serial data to the servo controller causing the two continuous rotation servo's to spin.

When I first built it, it worked, and then every time I powered it down, it would sometimes work, and as of now, it doesn't work at all. I thought maybe the battery had gotten to low on the Stamp and changed it, but it did nothing. I made sure it was sending serial data by having it send a message to a serial LCD and that acts. But the servo controller doesn't respond. There is a green LED indicator for incoming serial data on it that is SUPPOSED to respond, but it does nothing; it did, but now I got nothing.

I skipped the Xbee completely by using a hardware DUBUG command and still the same result.

I wanted to make sure there wasn't something wrong with something I couldn't see before assuming it is the controller and finding a replacement. Thanks in advance, and my code will be posted below.
' {$STAMP BS2}
' {$PBASIC 2.5}


'Remote Control Bot v1


Direction   VAR   Word


ServoCtrl  CON 0
R_ServoP   CON 1
L_ServoP   CON 5


Setup:
SEROUT 14, 84, [22,12]
PAUSE 5






 Main:


 SERIN 12, 84, [direction]
 SEROUT 14, 84, [direction]


 IF direction = "w" THEN
  SEROUT 0, 84, [$80,$01,$04,R_ServoP,20,50]
  SEROUT 0, 84, [$80,$01,$04,L_ServoP,24,50]
  SEROUT 14, 84, [12,"Moving Forward"]
 GOTO Main




 ELSEIF direction = "a" THEN
  SEROUT 0, 84, [$80,$01,$04,R_ServoP,21,50]
  SEROUT 0, 84, [$80,$01,$04,L_ServoP,22,50]
  SEROUT 14, 84, [12,"Turning Left"]
 GOTO Main


 ELSEIF direction = "s" THEN
  SEROUT 0, 84, [$80,$01,$04,R_ServoP,24,50]
  SEROUT 0, 84, [$80,$01,$04,L_ServoP,20,50]
  SEROUT 14, 84,[12,"Moving Backwards"]
 GOTO Main
 ELSEIF direction = "d" THEN
  SEROUT 0, 84, [$80,$01,$04,R_ServoP,22,50]
  SEROUT 0, 84, [$80,$01,$04,L_ServoP,23,50]
  SEROUT 14, 84,[12,"Turning Right"]
  GOTO Main


 ELSE
 SEROUT 14, 84, [12,"[Invalid Character]"]
 PAUSE 5
 ENDIF


GOTO Main

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-27 18:26
    You really need to furnish links to the documentation for the non-Parallax devices like the Pololu controller. Given that your program seems to be receiving the data correctly via xBee (based on what's shown on the LCD), the only logical conclusion is that the servo controller is not responding properly for some reason. If you replace the Pololu controller, consider the Parallax Propeller Servo Controller.

    If the servo controller has a jumper controlled Baud setting, you might try switching to a lower Baud (like 2400) to see if that makes a difference
Sign In or Register to comment.