Resetting problem
Boooooom3
Posts: 1
Hey, i just got my Boe-Bot (birthday present).
There is one thing that i cant figure out:
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program running!"
pulseCount VAR Byte
pulseCount2 VAR Byte
pulseCount3 VAR Byte
DO
· IF (IN5 = 0) AND (IN7 = 0) THEN
··· GOSUB Back_Up
··· GOSUB Turn_Left
··· GOSUB Turn_Left
· ELSEIF (IN5 = 0) THEN
··· GOSUB Back_Up
··· GOSUB Turn_Right
· ELSEIF (IN7 = 0) THEN
··· GOSUB Back_Up
··· GOSUB Turn_Left
· ELSE
··· GOSUB Forward_Pulse
· ENDIF
LOOP
Forward_Pulse:
· PULSOUT 13, 850
· PULSOUT 12, 650
· PAUSE 20
· RETURN
Turn_Left:
· FOR pulseCount = 0 TO 20
··· PULSOUT 13, 650
··· PULSOUT 12, 650
··· PAUSE 20
· NEXT
· RETURN
Turn_Right:
· FOR pulseCount2 = 0 TO 20
··· PULSOUT 13, 850
··· PULSOUT 12, 850
··· PAUSE 20
· NEXT
· RETURN
Back_Up:
· HIGH 1
· HIGH 10
· FOR pulseCount3 = 0 TO 40
··· PULSOUT 13, 650
··· PULSOUT 12, 850
··· PAUSE 20
· NEXT
· LOW 1
· LOW 10
· RETURN
That code should work perfectly but there is something wrong. If i put the switch to 2 and run this code, it says "Program running!" not just once, it says it like once every second, and it moves very choppy too. It seems like it resets once every second.
Did anyone·else have this problem? If so, how did you solve it?
There is one thing that i cant figure out:
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program running!"
pulseCount VAR Byte
pulseCount2 VAR Byte
pulseCount3 VAR Byte
DO
· IF (IN5 = 0) AND (IN7 = 0) THEN
··· GOSUB Back_Up
··· GOSUB Turn_Left
··· GOSUB Turn_Left
· ELSEIF (IN5 = 0) THEN
··· GOSUB Back_Up
··· GOSUB Turn_Right
· ELSEIF (IN7 = 0) THEN
··· GOSUB Back_Up
··· GOSUB Turn_Left
· ELSE
··· GOSUB Forward_Pulse
· ENDIF
LOOP
Forward_Pulse:
· PULSOUT 13, 850
· PULSOUT 12, 650
· PAUSE 20
· RETURN
Turn_Left:
· FOR pulseCount = 0 TO 20
··· PULSOUT 13, 650
··· PULSOUT 12, 650
··· PAUSE 20
· NEXT
· RETURN
Turn_Right:
· FOR pulseCount2 = 0 TO 20
··· PULSOUT 13, 850
··· PULSOUT 12, 850
··· PAUSE 20
· NEXT
· RETURN
Back_Up:
· HIGH 1
· HIGH 10
· FOR pulseCount3 = 0 TO 40
··· PULSOUT 13, 650
··· PULSOUT 12, 850
··· PAUSE 20
· NEXT
· LOW 1
· LOW 10
· RETURN
That code should work perfectly but there is something wrong. If i put the switch to 2 and run this code, it says "Program running!" not just once, it says it like once every second, and it moves very choppy too. It seems like it resets once every second.
Did anyone·else have this problem? If so, how did you solve it?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support