Wondering if the part in RED is causing the trouble? If it were eliminated and sent to
CheckIfInDanger:
after
keepreversing:
was satisfied???
Code:
keepreversing:
WHILE rangefront < stopreversing
' We have not reversed far enough
HIGH stopgo 'go
LOW forrev 'back
GOSUB triggers
WEND
'------------------------------------
'done reversing. Go straight or turn left depending on right
'ping. If > outertrack then out in the middle. If < desiredtrack
'then stuck on wall.
IF rangeright > desiredtrack THEN
'steer left
LOW turnon 'steer
HIGH steerto 'left
steeringstate = 1
HIGH stopgo 'go
HIGH forrev 'forward
PAUSE 500
'hpwm 2,Forward,50 --Already going Forward
ENDIF
GOTO main
Bookmarks