Shop OBEX P1 Docs P2 Docs Learn Events
need help with Coding — Parallax Forums

need help with Coding

GotchaSukkaGotchaSukka Posts: 3
edited 2006-06-02 02:56 in Learn with BlocklyProp
using pbasic, and a basic stamp 2 , where we have to make a car travel in a straight line for 2m.

my car starts of going in a straight line and then it travels off to the left. i have to make it go in a straight line. to compromise for that i have to turn both on then the car will start of straight, then turn 1 motor off so the car aligns to be straight again, and then have them both go so it travels in a straight line.

I need help with the coding in this task


this is my example code:


'make robot go in a straight line
' {$STAMP BS2}
' {$PBASIC 2.5}

LOW 12································ 'the motor is stopped for 10 s
LOW 13
LOW 14
LOW 15
PAUSE 10000

LOW 12································ 'makes the motor go straight for 5 s
HIGH 13
LOW 14
HIGH 15
PAUSE 5000

······································· 'car staops for 10 seconds
LOW 12
LOW 13
LOW 14
LOW 15
PAUSE 10000
counter VAR Byte
····································· 'one motor will run and count to 10 then
FOR counter = 1 TO 10················ 'the car will turn right
DEBUG ? counter
LOW 12
HIGH 13
LOW 14
LOW 15
PAUSE 10000
NEXT
DEBUG "all done"

LOW 12··············································'car will continue·going in a straight line
HIGH 13············································ 'for 10 seconds
LOW 14
HIGH 15
PAUSE 10000

LOW 12
LOW 13·············································· 'car will stop
LOW 14
LOW 15

Post Edited (GotchaSukka) : 6/2/2006 11:37:21 AM GMT
Sign In or Register to comment.