122-27400 Parallax Inc, 122-27400 Datasheet - Page 39

MANUAL FOR SUMOBOT

122-27400

Manufacturer Part Number
122-27400
Description
MANUAL FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 122-27400

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
The movement logic is controlled by SELECT-CASE . The purpose of SELECT-CASE is
to replace several IF-THEN commands that would examine the same control variable.
So, the following code structure:
replaces these statements, as well as the program labels and associated code for them:
and accomplishes the same objective.
SELECT-CASE is a clean solution. As programs grow, we'll examine other instructions
(like BRANCH) to replace multiple IF-THEN comparisons and route the program to
desired control routines. Keep in mind that program 3.2 doesn't actually move the
SumoBot. It simply displays the action that should be taken given the QTI inputs.
OUR FIRST OPERATIONAL SUMO PROGRAM
With the ability to move and to see the border on the Sumo ring, we have enough to
create a working Mini-Sumo program. Add a 470 Ω resistor and LED to the breadboard
as shown in Figures 3.3 and 3.4, and then load and run program 3.3.
SELECT lineBits
ENDSELECT
IF (lineBits = %00) THEN Go_Fwd
IF (lineBits = %01) THEN Spin_Left
IF (lineBits = %10) THEN Spin_Right
IF (lineBits = %11) THEN About_Face
CASE %00
CASE %01
CASE %10
CASE %11
DEBUG "Continue forward", CLREOL
DEBUG "Spin Left", CLREOL
DEBUG "Spin Right", CLREOL
DEBUG "Back up and turn around", CLREOL
Figure 3.3: Start LED Schematic
Chapter 3: SumoBot Sensors and Border Detection · Page 29
With simple programs like this one, using
' display actions

Related parts for 122-27400