27297 Parallax Inc, 27297 Datasheet - Page 65
27297
Manufacturer Part Number
27297
Description
KIT STAMPWORKS WITH BS2-IC
Manufacturer
Parallax Inc
Datasheet
1.27297.pdf
(230 pages)
Specifications of 27297
Lead Free Status
Contains lead
Product
Microcontroller Accessories
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Available stocks
Company
Part Number
Manufacturer
Quantity
Price
- Current page: 65 of 230
- Download datasheet (3Mb)
return a remainder of zero, using modulus in this manner causes mode to “wrap-
around” from four to zero.
The final element of the main loop is called Show. This code uses ON-GOSUB to call
the code that will output the light sequence specified by mode. Modes A through D
work similarly, retrieving light sequences from the BASIC Stamp’s EEPROM (stored in
DATA statements). Mode E outputs a random light pattern.
Take a look at the code section labeled ModeA. The first thing that happens is that
the variable, offset, is updated – again using the “wrap-around” technique with
the modulus operator. The value of offset is added to the starting position of the
specified light sequence and the current light pattern is retrieved from EEPROM with
READ. Notice that the DATA statements for each sequence are labeled (SeqA, SeqB,
etc.). Internally, each of these labels is converted to a constant value that is equal
to the starting address of the sequence. The length of each sequence is calculated
with these constants.
(shortened or lengthened) without having to modify the operational code called by
Show. ModeE is very straightforward, using the RANDOM function to output new
pattern of lights with each pass through the main loop.
Take it Further
Add a new lighting sequence. What sections of the program need to be modified to
make this work?
Write Code like a Pro
The modulus operator (//) is extremely useful, yet shunned by many beginning
programmers as “mysterious.” It’s not, really, in fact its operation is very simple: it
returns the remainder of an integer division. In practice what this means is that the
modulus of any value will fall into the range of zero to the value minus one.
Beginners will often do this:
idx = idx + 1
IF (idx = 5) THEN
ENDIF
idx = 0
By using this technique, light patterns can be updated
Related parts for 27297
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Microcontroller Modules & Accessories DISCONTINUED BY PARALLAX
Manufacturer:
Parallax Inc
Part Number:
Description:
BOOK UNDERSTANDING SIGNALS
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
COMPETITION RING FOR SUMOBOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
TEXT INFRARED REMOTE FOR BOE-BOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BOARD EXPERIMENT+LCD NX-1000
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
CONTROLLER 16SERVO MOTOR CONTROL
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BASIC STAMP LOGIC ANALYZER
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
IC MCU 2K FLASH 50MHZ SO-18
Manufacturer:
Parallax Inc
Datasheet: