Shop OBEX P1 Docs P2 Docs Learn Events
Resetting problem — Parallax Forums

Resetting problem

Boooooom3Boooooom3 Posts: 1
edited 2007-02-13 19:50 in BASIC Stamp
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?

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-02-13 19:50
    This is usually a result of low batteries or using rechargeable batteries. This causes low voltage brownouts to occur. Please try a fresh set of batteries and see if that helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.