Shop OBEX P1 Docs P2 Docs Learn Events
Need help with RC car forward and reverse issue — Parallax Forums

Need help with RC car forward and reverse issue

azpoultonazpoulton Posts: 3
edited 2010-01-29 07:11 in BASIC Stamp
Hello,

I am new to parallax boards and I am working on a Board of Education USB rev B. I have connected it to a Dynamite Tazer 15T RC car controller in the 12 and 13 locations (X5). I have been using pulsout commands to figure out how to get the car to go forward, reverse,left ,right. My question is, when i try to go forward and then reverse in the same code, the reverse will not work. For example, i try to go forward and then pause for 5000 and then go reverse and the reverse will not work, but if i go reverse and then forward it works. If i try reverse and then forward and then reverse again, it will not work. I usually have to turn the board and the car off and then on again to get the car to go reverse again. I have LEDs plugged in for debug reasons, and they light up like they should. Here is the code:

' {$STAMP BS2p}
' {$PBASIC 2.5}

counter        VAR     Word

DEBUG "backwards", CR
FOR counter = 1 TO 15
PULSOUT 12, 4100
PAUSE 20
NEXT

PAUSE 5000

DEBUG "Forward", CR
FOR counter = 1 TO 15
 PULSOUT 12, 1300
  PAUSE 20
NEXT

PAUSE 5000

DEBUG "backwards", CR
FOR counter = 1 TO 15
PULSOUT 12, 4100
PAUSE 20
NEXT




The second "backwards" code runs, but the car wheels don't move. Is the issue my code? Or the car?

Comments

  • azpoultonazpoulton Posts: 3
    edited 2010-01-25 07:55
    UPDATE: I was troubleshooting and learned that I have to turn off the car and the board. If I just turn off one or the other, reverse will not work.
  • azpoultonazpoulton Posts: 3
    edited 2010-01-29 05:51
    SOLVED: I was not looping enough times for the servo to go in reverse. This updated example code shows the forward pulsout needs much less then the reverse pulsout.

    DO
    
    DEBUG "backwards", CR
    FOR counter = 1 TO 50
    PULSOUT 12, 2500
    PAUSE 10
    NEXT
    
    PAUSE 3000
    
    DEBUG "forwards", CR
    FOR counter = 1 TO 2
    PULSOUT 12, 1250
    PAUSE 20
    NEXT
    
    PAUSE 3000
    
    LOOP
    
    END
    
    
  • rekk1986rekk1986 Posts: 6
    edited 2010-01-29 07:11
    I am also a newbie to this forum, so I join with the aim of learning something from all of you here.
Sign In or Register to comment.