Shop OBEX P1 Docs P2 Docs Learn Events
Robot going backwards-help please — Parallax Forums

Robot going backwards-help please

hdingramhdingram Posts: 6
edited 2011-02-28 18:04 in Robotics
I purchase the Board of Education Development Board (USB), and
the 7.2V Motor, Bracket and Wheel Kit. I hook everything up added a
h-bridge and i still cannot get my robot to run backward. Here is the program I am using

' Robotics with the Boe-Bot - ForwardLeftRightBackward.bs2
' Move forward, left, right, then backward for testing and tuning.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
FOR counter = 1 TO 6 ' Forward
PULSOUT 11, 850
PULSOUT 13, 450
PULSOUT 5, 850
PULSOUT 6, 450
PAUSE 20
NEXT
'PAUSE 4000

FOR counter = 1 TO 6 ' Backward
PULSOUT 11, 450
PULSOUT 13, 850
PULSOUT 5, 450
PULSOUT 6, 850
PAUSE 20
NEXT
END

FOR counter = 1 TO 24 ' Rotate left - about 1/4 turn
PULSOUT 11, 450
PULSOUT 13, 450
PULSOUT 5, 450
PULSOUT 6, 450
PAUSE 20
NEXT
PAUSE 4000
FOR counter = 1 TO 24 ' Rotate right - about 1/4 turn
PULSOUT 11, 850
PULSOUT 13, 850
PULSOUT 5, 850
PULSOUT 6, 850
PAUSE 20
NEXT
PAUSE 4000



Please help

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-23 10:37
    How about some information on what's connected to the various I/O pins you've referenced? What H-bridge are you using? Why do you have the rotate routines listed when they will never execute?
  • ercoerco Posts: 20,256
    edited 2011-02-23 14:16
    edit: this assumes you have one h-bridge on 11&13, and the other is on 5&6

    FOR counter = 1 TO 6 ' Forward
    PULSOUT 11, 850
    PULSOUT 13, 450
    PULSOUT 5, 850
    PULSOUT 6, 450
    PAUSE 20
    NEXT
    PAUSE 4000

    FOR counter = 1 TO 6 ' Backward
    PULSOUT 11, 450
    PULSOUT 13, 450
    PULSOUT 5, 850
    PULSOUT 6, 850
    PAUSE 20
    NEXT
    PAUSE 4000


    FOR counter = 1 TO 24 ' Rotate left - about 1/4 turn
    PULSOUT 11, 450
    PULSOUT 13, 450
    PULSOUT 5, 450
    PULSOUT 6, 450
    PAUSE 20
    NEXT
    PAUSE 4000
    FOR counter = 1 TO 24 ' Rotate right - about 1/4 turn
    PULSOUT 11, 850
    PULSOUT 13, 850
    PULSOUT 5, 850
    PULSOUT 6, 850
    PAUSE 20
    NEXT
    PAUSE 4000
  • hdingramhdingram Posts: 6
    edited 2011-02-24 15:05
    hey i used the above code but i think my problem is because the program was written for servo motors how do i change this and how do i delete a thread
  • ercoerco Posts: 20,256
    edited 2011-02-24 15:11
    Your initial post sounded like it WAS working properly in fwd, left and right, just not reverse. But now we are slowly learning that it never moved at all, correct?

    To help, we need info on how to switch your H-bridge. Do YOU know how?
  • hdingramhdingram Posts: 6
    edited 2011-02-28 11:23
    yes it is working but only running forward. I dont know if my h bridge is hook up correctly or not i will attached picture shortly
  • ercoerco Posts: 20,256
    edited 2011-02-28 13:18
    It doesn't sound like you're in any hurry to solve your problem, huh? :)
  • hdingramhdingram Posts: 6
    edited 2011-02-28 15:09
    i am in a hurry but i lost internet signal
    640 x 480 - 125K
    240 x 320 - 20K
    640 x 480 - 51K
    240 x 320 - 22K
  • hdingramhdingram Posts: 6
    edited 2011-02-28 16:20
    yes please help i need this done by today i do not know what i am doing wrong please help
  • W9GFOW9GFO Posts: 4,010
    edited 2011-02-28 18:04
    FIrst, what are you using to power the motors? A 9V battery cannot supply enough current to run motors. A pack of 6 AAs would work nicely.

    Second, six times through a FOR..NEXT loop that takes only ~25 milliseconds to execute does not give enough time to do anything useful. You have the motors moving forward and backward for only 1/6th of a second.

    Lastly, I don't think PULSOUT is what you need to drive your H Bridges. Look at the PWM command.

    Rich H
Sign In or Register to comment.