27403 Parallax Inc, 27403 Datasheet - Page 53

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
temp = temp + 1
WRITE EepromCounter, temp
temp = temp - 1
IF temp = 0 THEN
ELSE
ENDIF
END
Your Turn - Distinguishing Odd from Even
You can determine whether the Reset button has been pressed/released an odd or even
number of times by examining the
counts up in binary, the rightmost binary bit (1 or 0) changes every time. Here is an
example:
Aside from the fact that it changes every time, notice that the rightmost bit is always 1 for
odd numbers and 0 for even numbers. If you want your program to take action based on
whether a value is odd or even, you'll need to access this rightmost binary bit and use it in
IF...THEN
PBASIC has the
values in a variable. The rightmost binary value, is accessed with
DEBUG "Since download, you have", CR,
DEBUG CRSRX, 11, "...", DEC temp,
Decimal
"pressed Reset ", DEC temp,
" times.", CR
" times.", CR
statements.
0
1
2
3
4
5
6
7
.BIT
(pronounced "dot-bit") operator for accessing the individual binary
%0000
%0001
%0010
%0011
%0100
%0101
%0110
%0111
Binary
temp
variable as a binary number. When a variable
.BIT0
. The second

Related parts for 27403