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

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
useful for controlling the SumoBot in a competition without fumbling for the actual
power switch.
The code at Reset reads a byte from the BASIC Stamp's EEPROM; located at the address
called RunStatus . When the program is first downloaded to the BASIC Stamp, the value
stored in RunStatus will be $00 (don't run). The READ instruction is used to bring this
value into the variable temp , then temp is inverted (to $FF), and finally, WRITE is used to
put it back to the EEPROM for the next reset cycle. Next, the value of temp is tested for
greater than zero. If this condition is true, the program is halted with END (which puts the
BASIC Stamp goes into low-power mode), otherwise it continues to the Start_Delay
code.
The routine called Start_Delay satisfies a requirement of Mini-Sumo competition rules.
The rules state that the robot must not start until five seconds after the command is given
by the judge. This code is very simple: it lights the LED to show that the SumoBot is
preparing to start and inserts a five second PAUSE . At the end of the delay, the LED will
be extinguished and the SumoBot will start moving.
The heart of the program begins at Main. The first step is to read the sensors with the
Read_Line_ Sensors subroutine. With the QTI sensor data, the SumoBot is moved using
the same logic developed earlier:
BRANCH takes care of routing the program to the right code section based on the QTI
inputs. As with SELECT-CASE , we're using BRANCH to replace several IF-THEN
comparisons. It should be clear that this is a cleaner approach than IF-THEN .
The only thing that might not be clear is that there is no delay (20 ms) in the Go_Fwd
routine. It isn't needed when the SumoBot is in the middle of the ring (not touching the
border line) because reading the QTI sensors consumes enough time that the delay is not
necessary.
L
0
0
1
1
R
0
1
0
1
Action
Move forward
Spin to left
Spin to right
Back up and turn around
Chapter 3: SumoBot Sensors and Border Detection · Page 33

Related parts for 122-27400