Shop OBEX P1 Docs P2 Docs Learn Events
Bumper Bump — Parallax Forums

Bumper Bump

Sing AmericaSing America Posts: 17
edited 2009-11-10 02:23 in BASIC Stamp
Hi,
I was wondering if someone could look at this program and allude to my inabilities to get it to work.· The program if attached to the computer works but as soon as I try to run it without the connection to the computer it doesn't.· Checked batteries and that is not it and I have used several boards with the same results.· I would appreciate some knowledge explaining why....

P0 - Bumper 1
P1 - Bumper 2
P2 - Bumper 3
P12 - Left wheel
P13 - Right wheel

Code: I have two,
Main:
DO
· DEBUG ? IN3
· DEBUG ? IN2
· DEBUG ? IN1
··· PULSOUT 12, 700
··· PAUSE 20
··· PULSOUT 13, 800
··· PAUSE 20
····· IF (IN1 = 1) THEN· moveright
····· IF (IN2 = 1) THEN· moveleft
····· IF (IN3 = 1) THEN· backbutton
LOOP
· 'Subprograms---
moveright:
Ends with "return


'Main Program- second one
Main:
DO
DEBUG ? IN3
DEBUG ? IN2
DEBUG ? IN1
······· IF(IN0 = 0)AND(IN1 = 0)AND(IN2 = 0)THEN
···· PULSOUT 12, 700
···· PULSOUT 13, 800
···· PAUSE 10

······ IF IN0 = 1 THEN moveright
········ IF(IN1 = 1) THEN moveleft
······· IF (IN2 = 1) THEN backbutton

····· ENDIF
· GOTO Main
LOOP
Subprograms:
all end with "return"

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-11-10 02:23
    Try commenting out the debugs, and running attached to a computer. Does it work?
Sign In or Register to comment.