27403 Parallax Inc, 27403 Datasheet - Page 162

GUIDE APP ROBOTCS W/SUMOBOT V1.0

27403

Manufacturer Part Number
27403
Description
GUIDE APP ROBOTCS W/SUMOBOT V1.0
Manufacturer
Parallax Inc
Datasheet

Specifications of 27403

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
SumoBot®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
way to ensure this is to keep a subroutine that's in charge of both sending pulses to the
servos and checking sensors. In the code below, every time the Main Routine calls
Servos_And_Sensors
(
Below is an excerpt from the next example program. The
maneuver
UNTIL (irLF = 1 AND irRF = 1) OR counter > 15
condition. Notice that the loop has two conditions that will cause the program to exit the
loop. The first is
stop when the SumoBot has pivoted far enough to see the object with both eyes. The
condition
its opponent pushes it out of the ring.
DO
LOOP
Read_Object_Detectors
IF irLF = 1 AND irRF = 1 THEN
ELSEIF irLF = 1 THEN
ELSEIF irRF = 1 THEN
.
.
.
maneuver = Forward
GOSUB Servos_And_Sensors
counter = 0
DO UNTIL (irLF = 1 AND irRF = 1) OR counter > 15
LOOP
maneuver = PivotLeft
GOSUB Servos_And_Sensors
counter = counter + 1
' -----[ Subroutine - Servos_And_Sensors ]-----------------------------
Servos_And_Sensors:
...OR counter > 15
GOSUB Pulse_Servos
' Call sensor subroutine(s).
sensors = 0
GOSUB Read_Object_Detectors
RETURN
equal to
(irLF = 1 AND irRF = 1)
PivotLeft
, both the
in this case) get checked.
, then it calls
Pulse_Servos
prevents the SumoBot from pivoting indefinitely while
Servos_And_Sensors
. It makes the loop will automatically
subroutine and the sensors subroutines
' Both?
' State = Lunge forward
' Just left?
' State = track front left object
' Pivot left 15
' Just right?
' Call Pulse_Servos subroutine
' Clear previous sensor values
' Call Read_Object_Detectors
is what looks for the correct
ELSEIF
. The statement
code block sets
DO

Related parts for 27403