27220 Parallax Inc, 27220 Datasheet - Page 47

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
Program: SW21-EX04-SciFi_LEDs.BS2:
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ Program Description ]---------------------------------------------
'
' "Ping-Pongs" a single LED back-and-forth across a bank of eight.
' program will work, unmodified, on any BS2-family module.
' -----[ I/O Definitions ]-------------------------------------------------
LEDs
LEDsDirs
' -----[ Constants ]-------------------------------------------------------
DelayTm
' -----[ Initialization ]--------------------------------------------------
Reset:
' -----[ Program Code ]----------------------------------------------------
Main:
LEDS = %00000001
LEDsDirs = %11111111
DO WHILE (LEDs < %10000000)
LOOP
DO
LOOP UNTIL (LEDs = %00000001)
GOTO Main
3. Plug the other end into LED 0.
4. Repeat steps 2 and 3 for P1 – P7 connecting to LEDs 1 – 7, respectively.
PAUSE DelayTm
LEDs = LEDs << 1
PAUSE DelayTm
LEDs = LEDs >> 1
VAR
VAR
CON
OUTL
DIRL
100
' LEDs on P0 - P7
' DIRS control for LEDs
' delay time for lit LED
' start with right LED on
' make LEDs outputs
' test for left extreme
' on-time for lit LED
' shift LED left
' shift LEDs right
' test for right extreme
This

Related parts for 27220