Shop OBEX P1 Docs P2 Docs Learn Events
go staight using BS2px — Parallax Forums

go staight using BS2px

qiuqiuaaaqiuqiuaaa Posts: 37
edited 2012-01-03 23:34 in General Discussion
I am using BS2px, and I want it to go straight. I found a strange problem.
My program is as below:

' {$STAMP BS2px}
' {$PBASIC 2.0}
counter VAR Word
FOR counter = 1 TO 244
PULSOUT 12,650
PULSOUT 13,850
NEXT

It turns right, but I think it must be straight in BS2. I also tried 650,750,850 for each wheel, and none of them works, always rotates. I am confused .
Thanks.

Comments

  • ercoerco Posts: 20,261
    edited 2012-01-03 22:52
    We're talking about a BoeBot?

    Did you adjust both of your servos to stop at 750? That's the first step. Then you have to realize that it will never go perfectly straight since the servos are slightly different. You can adjust by manually slowing one down like 660,850. The BoeBot wheel encoder kit can help make it go straighter, FYI.

    Please clarify what you have/haven't done and what you do/don't understand for us to help you best.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-01-03 23:10
    qiuqiuaaa,

    Welcome to the Parallax Forum!

    The pulse duration for each PULSOUT increment in the BS2px is 0.8 us, compared with 2 us for the BS2. Therefore, to get the same pulse width from the BS2px as the BS2, the duration argument to PULSOUT has to be multiplied by 2 / 0.8 = 2.5. So try
    PULSOUT 12,1625
    PULSOUT 13,2375

    instead of what you're currently using.

    -Phil
  • ercoerco Posts: 20,261
    edited 2012-01-03 23:12
    Genious, PhiPi!
  • qiuqiuaaaqiuqiuaaa Posts: 37
    edited 2012-01-03 23:34
    Wow, it works! Thank you so much.
    qiuqiuaaa,

    Welcome to the Parallax Forum!

    The pulse duration for each PULSOUT increment in the BS2px is 0.8 us, compared with 2 us for the BS2. Therefore, to get the same pulse width from the BS2px as the BS2, the duration argument to PULSOUT has to be multiplied by 2 / 0.8 = 2.5. So try
    PULSOUT 12,1625
    PULSOUT 13,2375

    instead of what you're currently using.

    -Phil
Sign In or Register to comment.