28123 Parallax Inc, 28123 Datasheet - Page 74

TEXT WHAT'S A MICROCONTROLLER

28123

Manufacturer Part Number
28123
Description
TEXT WHAT'S A MICROCONTROLLER
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28123

Style
Book
Title
What's a Microcontroller?
Contents
Whats a Microcontroller? Text
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
Lead Free Status / RoHS Status
Not applicable / Not applicable
Example Program: TestBiColorLED.bs2
' What's a Microcontroller - TestBiColorLed.bs2
' Turn bi-color LED red, then green, then off in a loop.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
DO
LOOP
Your Turn – Lights Display
In Activity #3, a variable named
blinked. What happens if you use the value
Duration
HIGH 15
LOW 14
PAUSE 500
LOW 15
HIGH 14
PAUSE 500
LOW 15
LOW 14
PAUSE 500
The bi-color LED will also turn off if you send high signals to both P14 and P15. Why?
Because the electrical pressure is the same at P14 and P15 regardless of whether you set
both I/O pins high or low.
Reconnect power.
Enter the TestBiColorLed.bs2 code into the BASIC Stamp Editor.
Run the program.
Verify that the LED cycles through the red, green, and off states.
Rename and save TestBiColorLed.bs2 as TestBiColorLedYourTurn.bs2.
Add a counter variable declaration before the
argument?
' Red
' Green
' Off
counter
was used to control how many times the LED
counter
to control the
DO
statement:
PAUSE
command’s

Related parts for 28123