Parallax Boe-Bot Assembly page 57

Mini-sumo robotics assembly documentation and programming
Hide thumbs Also See for Boe-Bot:
Table of Contents

Advertisement

temp
VAR
' -----[ EEPROM Data ]-----------------------------------------------------
RunStatus
DATA
' -----[ Initialization ]--------------------------------------------------
Reset:
READ RunStatus, temp
temp = ~temp
WRITE RunStatus, temp
IF (temp > 0) THEN END
' Sets black threshold to 1/4 the average of the two sensor readings.
' SumoBot must be placed over black playing surface before this code runs.
Set_Threshold:
GOSUB Read_Line_Sensors
blackThresh = (lLine / 10) + (rLine / 10)
LOW LMotor
LOW RMotor
Start_Delay:
FOR temp = 1 TO 5
HIGH StartLED
PAUSE 900
INPUT StartLED
FREQOUT Speaker, 100, 2500, 3000
NEXT
GOTO Lunge
' -----[ Program Code ]----------------------------------------------------
Main:
GOSUB Read_Line_Sensors
' If not on the Shikiri line (border), continue to look for opponent,
' otherwise, spin back toward center and resume search
BRANCH lineBits, [Search_For_Opponent, Spin_Left, Spin_Right, About_Face]
' --[ Border Avoidance ]--
Spin_Left:
FOR pulses = 1 TO 20
PULSOUT LMotor, LRevFast
PULSOUT RMotor, RFwdFast
PAUSE 20
Chapter 5: Basic Competition Code · Page 47
Byte
$00
' run status
' read current status
' invert status
' save for next reset
' okay to run?
' set QTI black threshold
' make more pins outputs
' five second delay
' show active
' blink each second
' beep each second
' start aggressive!
' right sensor was active

Advertisement

Table of Contents
loading

This manual is also suitable for:

QuadcrawlerToddlerSumobotHexcrawler

Table of Contents