Datasheet

Page 180ยท Applied Robotics with the SumoBot
DummyPin PIN 6 ' I/O pin for pulse-decay P6
' -----[ Constants ]----------------------------------------------------------
' SumoBot maneuvers
Forward CON 0 ' Forward
Backward CON 1 ' Backward
RotateLeft CON 2 ' RotateLeft
RotateRight CON 3 ' RotateRight
PivotLeft CON 4 ' Pivot to the left
PivotRight CON 5 ' Pivot to the right
CurveLeft CON 6 ' Curve to the left
CurveRight CON 7 ' Curve to the right
' Servo pulse width rotations
FS_CCW CON 850 ' Full speed counterclockwise
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
' -----[ 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
' -----[ EEPROM Data ]--------------------------------------------------------
QtiThresh DATA Word 0 ' Word for QTI threshold time
' -----[ Initialization ]-----------------------------------------------------
GOSUB Calibrate_Qtis ' Determine b/w threshold
' -----[ Main Routine ]-------------------------------------------------------
DO
IF qtiLF = 1 THEN ' Left qti sees line?
FOR counter = 1 TO 15 ' State = Avoid tawara left