RStop
CON
RRevSlow
CON
RRevFast
CON
' -----[ Variables ]-------------------------------------------------------
lLine
VAR
rLine
VAR
lineBits
VAR
lbLeft
VAR
lbRight
VAR
pulses
VAR
temp
VAR
' -----[ EEPROM Data ]-----------------------------------------------------
RunStatus
DATA
' -----[ Initialization ]--------------------------------------------------
Reset:
READ RunStatus, temp
temp = ~temp
WRITE RunStatus, temp
IF (temp > 0) THEN END
Start_Delay:
HIGH StartLED
PAUSE 5000
LOW StartLED
' -----[ Program Code ]----------------------------------------------------
Main:
GOSUB Read_Line_Sensors
' sumo movement
BRANCH lineBits, [Go_Fwd, Spin_Left, Spin_Right, About_Face]
Go_Fwd:
PULSOUT LMotor, LFwdFast
PULSOUT RMotor, RFwdFast
GOTO Main
Spin_Left:
FOR pulses = 1 TO 20
PULSOUT LMotor, LRevFast
PULSOUT RMotor, RFwdFast
PAUSE 20
NEXT
Chapter 3: SumoBot Sensors and Border Detection · Page 31
750
800
1000
Word
Word
Nib
lineBits.BIT1
lineBits.BIT0
Byte
Byte
$00
' right motor stop
' right motor rev; slow
' right motor rev; fast
' left sensor raw reading
' right sensor raw reading
' decoded sensors value
' counter for motor control
' run status
' read current status
' invert status
' save for next reset
' run now?
' show active
' start delay
' LED off
Need help?
Do you have a question about the Boe-Bot and is the answer not in the manual?
Questions and answers