Datasheet

Page 202ยท Applied Robotics with the SumoBot
Track_Side_Right_Object:
DO UNTIL irRF = 1 OR irLF = 1 ' Rotate right
maneuver = RotateRight
GOSUB Servos_And_Sensors
LOOP
RETURN
' -----[ Subroutine - Search_Pattern ]----------------------------------------
Search_Pattern:
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:
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
RETURN