Datasheet

Page 230ยท Applied Robotics with the SumoBot
#IF DEBUG_MODE = 1 #THEN state = TSLO #ENDIF
DO UNTIL irRF = 1 OR irLF = 1 ' Rotate left
maneuver = RotateLeft
GOSUB Servos_And_Sensors
LOOP
RETURN
' -----[ Subroutine - Track_Side_Right_Object ]-------------------------------
Track_Side_Right_Object:
#IF DEBUG_MODE = 1 #THEN state = TSRO #ENDIF
DO UNTIL irRF = 1 OR irLF = 1 ' Rotate right
maneuver = RotateRight
GOSUB Servos_And_Sensors
LOOP
RETURN
' -----[ Subroutine - Search_Pattern ]----------------------------------------
Search_Pattern:
#IF DEBUG_MODE = 1 #THEN state = SP #ENDIF
FOR counter = 1 TO 35 ' and watch all sensors
maneuver = Forward ' Forward
GOSUB Servos_And_Sensors
IF sensors <> 0 THEN GOTO Next_State
NEXT
Look_About:
#IF DEBUG_MODE = 1 #THEN state = SP #ENDIF
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