27404 Parallax Inc, 27404 Datasheet - Page 52

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
To make the program count the number of consecutive resets, simply add 1 to the value
of
time the program starts, the value the
The program can then make decisions based on the value of the
simplify things, the next example program subtracts 1 from
the
Your Turn section a little easier to follow.
Example Program: ResetButtonCounter.bs2
This program displays the number of times you have pressed and released the SumoBot's
Reset button after the program was downloaded.
' Applied Robotics with the SumoBot - ResetButtonCounter.bs2
' {$STAMP BS2}
' {$PBASIC 2.5}
EepromCounter DATA 0
temp VAR Byte
READ EepromCounter, temp
temp
IF...THEN
READ EepromCounter, temp
temp = temp + 1
WRITE EepromCounter, temp
temp = temp - 1
IF temp = 0 THEN
ELSE
ENDIF
Enter, save, and run ResetButtonCounter.bs2.
Watch the Debug Terminal as you repeatedly press/release the SumoBot's Reset
button.
and write it back to the EEPROM byte at the
DEBUG "Since download, you have", CR,
DEBUG CRSRX, 11, "...", DEC temp,
statement. Subtracting 1 from
"pressed Reset ", DEC temp,
" times.", CR
" times.", CR
READ
command fetches will be higher by 1.
temp
is not necessary, it just makes the
EepromCounter
temp
before analyzing it with
temp
address. Next
variable. To

Related parts for 27404