Datasheet

Page 188ยท Applied Robotics with the SumoBot
FS_CW CON 650 ' Full speed clockwise
NO_ROT CON 750 ' No rotation
LS_CCW CON 770 ' Low speed counterclockwise
LS_CW CON 730 ' Low speed clockwise
' IR object detectors
IrFreq CON 38500 ' IR LED frequency
' -----[ Variables ]----------------------------------------------------------
temp VAR Word ' Temporary variable
multi VAR Word ' Multipurpose variable
counter VAR Byte ' Loop counting variable.
maneuver VAR Nib ' SumoBot travel maneuver
sensors VAR Byte ' Sensor flags byte
qtiLF VAR sensors.BIT5 ' Stores snapshot of QtiSigLeft
qtiRF VAR sensors.BIT4 ' Stores snapshot of QtiSigRight
irLS VAR sensors.BIT3 ' State of Left Side IR
irLF VAR sensors.BIT2 ' State of Left Front IR
irRF VAR sensors.BIT1 ' State of Right Front IR
irRS VAR sensors.BIT0 ' State of Right Side IR
' -----[ EEPROM Data ]--------------------------------------------------------
RunStatus DATA 0 ' Run status EEPROM byte
QtiThresh DATA Word 0 ' Word for QTI threshold time
' -----[ Initialization ]-----------------------------------------------------
GOSUB Reset ' Wait for Reset press/release
GOSUB Start_Delay ' 5 Second delay
GOSUB Calibrate_Qtis ' Determine b/w threshold
GOTO Look_About ' Start mid search pattern
' -----[ Main Routine ]-------------------------------------------------------
DO
IF qtiLF = 1 THEN ' Left QTI sees line?
FOR counter = 1 TO 15 ' State = Avoid tawara left
maneuver = Backward ' Back up
GOSUB Servos_And_Sensors
NEXT
FOR counter = 1 TO 15 ' Turn right
maneuver = RotateRight
GOSUB Servos_And_Sensors