Datasheet

Page 190ยท Applied Robotics with the SumoBot
IF sensors <> 0 THEN GOTO Next_State
NEXT
Look_About: ' Starting point label
FOR counter = 1 TO 12 ' Look right
maneuver = RotateRight
GOSUB Servos_And_Sensors
IF sensors <> 0 THEN GOTO Next_State
NEXT
FOR counter = 1 TO 24 ' Look left
maneuver = RotateLeft
GOSUB Servos_And_Sensors
IF sensors <> 0 THEN GOTO Next_State
NEXT
FOR counter = 1 TO 12 ' Re-align to forward
maneuver = RotateRight
GOSUB Servos_And_Sensors
IF sensors <> 0 THEN GOTO Next_State
NEXT
Next_State: ' Exit point of search pattern
ENDIF
LOOP
' -----[ Subroutine - Reset ]-------------------------------------------------
Reset:
READ RunStatus, temp ' Byte @RunStatus -> temp
temp = temp + 1 ' Increment temp
WRITE RunStatus, temp ' Store new value for next time
IF (temp.BIT0 = 1) THEN ' Examine temp.BIT0
DEBUG CLS, "Press/release Reset", CR, ' 1 -> end, 0 -> keep going
"button..."
END
ELSE
DEBUG CR, "Program running..."
ENDIF
RETURN
' -----[ Subroutine - Start_Delay ]-------------------------------------------
Start_Delay:
FOR counter = 1 TO 5 ' 5 beeps, 1/second
PAUSE 900
FREQOUT LedSpeaker, 100, 3000
NEXT
RETURN