Bi-colored and Tri-Colored LEDs

Here are two projects showing the use of a bi-colored LED. In Exercise 009 we simply toggle it back and forth between red and green. But in Exercise 010 we use a homemade pulse width modulation scheme to vary the color continuously from red to orange to green (tri-color, through software). Both exercises use the same circuit configuration, so I've lumped them together here.

The schematic shows four possibilities for the actual display. Option (a) simply uses two separate LEDs. Option (b) employs a three-legged bi-color LED, and either or both colors may be shown; hence it requires two resistors. But only a single resistor is needed in Option (c), which implies the two elements (red and green) may not be illuminated simultaneously. Finally, Option (d) exploits a two-legged bi-color LED. We'll use the third option for these two projects.

Click to get the source code.
Click to get the schematic PDF.

In the next two exercises we'll see other methods for achieving the tri-color effect. These are considerably more elegant, and only slightly more complicated from a hardware or software standpoint.

Next project: Tri-Colored LED with a Single Port Pin

No comments:

Post a Comment