27404 Parallax Inc, 27404 Datasheet - Page 69

COMPETITION RING FOR SUMOBOT

27404

Manufacturer Part Number
27404
Description
COMPETITION RING FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 27404

Accessory Type
Hobby and Education
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
ACTIVITY #5: PUSHBUTTON PROGRAM MODE SELECTION
In some competitions, changing strategy between sumo rounds could make a big
difference in your SumoBot's standing. This activity introduces a simple technique you
can use to select the SumoBot's mode of operation based on cues from the speaker.
Selecting the Mode
In the next example program, you can enter a mode selection by pressing and holding the
pushbutton while you press and release the Reset button. After releasing the Reset
button, the program will beep once, then twice, then three times, and so on up to five
times. To select mode one, let go of the pushbutton after the speaker has beeped once.
To select mode two, keep holding the pushbutton, and instead let go after the speaker has
beeped twice. For mode three, wait for three beeps before letting go, and so on.
This program uses an EEPROM byte with a different
is another value that is initialized to zero when the program is downloaded, but
commands will change this value during run-time.
This
pressed. If it is, the
moves on to the next command.
The
uses the
first time through the outer loop,
inner loop is followed by a 1-second
the pushbutton. If the pushbutton has been released, the
value 1 stored by
If the pushbutton has not yet been released, the outer loop repeats. The second time
through the
another 1 second
Mode_Select
IF...THEN
' -----[ EEPROM Data ]-------------------------------------------------
ModeSelect
' -----[ Initialization ]----------------------------------------------
IF pbSense = 1 THEN GOSUB Mode_Select ' Call Mode_Select subroutine
temp
FOR...NEXT
variable to count from 1 to 5. The inner loop counts from 1 to
temp
statement in the Initialization routine checks to see if the pushbutton is
PAUSE
subroutine uses a pair of nested
Mode_Select
to the
, the outer loop again checks the pushbutton. If the pushbutton
loop,
DATA
ModeSelect
temp
temp
0
subroutine gets called. Otherwise, the program just
PAUSE
will be 2. So, the inner loop beeps twice. After
is 1, so the inner loop beeps the speaker once. The
EEPROM byte and exits the outer loop.
, after which, an
' Program select byte
FOR...NEXT
Symbol
IF...THEN
IF...THEN
name -
loops. The outer loop
statement writes the
ModeSelect
statement checks
temp
. This
WRITE
. The

Related parts for 27404