27220 Parallax Inc, 27220 Datasheet - Page 42

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
Write Code like a Pro
This version of the LED blinker is how a professional programmer would approach
the task. Why? What if you were asked to write a program that required several
LEDs and you assumed that they were active-high, yet after hours of work on the
program you were handed a schematic with LED connections that looked like this:
The LED in the schematic above is active-low; you must take the control pin low to
light the LED. Now you would be forced to change the HIGH commands that control
LEDs to LOW, and then original LOW commands to HIGH which would be a lot of work
and possibly lead to the introduction of program errors.
The professional programmer builds flexibility into the program so that an electrical
design change can be accommodated with ease. By using the strategy employed in
this experiment, we only have to change the following declarations:
The rest of the program remains unchanged and is ready to run.
IsOn
IsOff
CON
CON
0
1
' on for active-low LED
' off for active-low LED

Related parts for 27220