Program resets
onlymortal
Posts: 2
I modified a boe-bot to use a front axle for steering instead of the two wheel system that came with the kit. The problem is that the program has an error and reset's the program after the turning subroutine. I posted one of the subroutines below but can't find the problem. Does anyone know why the car is reseting?
starboard:
DEBUG "starboard",CR
PULSOUT 14, 615+pi 'turn right subroutine
PULSOUT 13, 650
PULSOUT 12, 830
PAUSE 20
pi=pi+5
IF(IN5=0)AND(IN7=1)THEN
GOSUB starboard
ELSE
GOSUB starboardc
ENDIF
RETURN
starboardc:
DEBUG "starboard counter",CR
FOR delta=1 TO pi STEP 6
PULSOUT 14, 615+pi-delta 'return wheels from right turn subroutine
PULSOUT 13, 650
PULSOUT 12, 830
PAUSE 20
NEXT
RETURN
starboard:
DEBUG "starboard",CR
PULSOUT 14, 615+pi 'turn right subroutine
PULSOUT 13, 650
PULSOUT 12, 830
PAUSE 20
pi=pi+5
IF(IN5=0)AND(IN7=1)THEN
GOSUB starboard
ELSE
GOSUB starboardc
ENDIF
RETURN
starboardc:
DEBUG "starboard counter",CR
FOR delta=1 TO pi STEP 6
PULSOUT 14, 615+pi-delta 'return wheels from right turn subroutine
PULSOUT 13, 650
PULSOUT 12, 830
PAUSE 20
NEXT
RETURN
Comments
One other possibility is that your servo is pulling too much power, which may be dropping your battery voltage and causing a brownout. Much depends on your mechanical construction and how much force is required to turn your axle. You could isolate this problem by giving the servos their own 6V battery supply, in which case you must connect both batteries negative leads together, but you knew that already.