LED Shield
An Adafruit protoshield with eight LEDs designed to display directions in conjunction with a GPS receiver.
Description
This is an Adafruit protoshield with eight LEDs arranged in a compass rose pattern, connected to Arduino digital I/O pins 4 through 11. The LEDs are connected to the digital I/O pins through 100 ohm resistors. To increase visibility, black heat shrink tubing has been added to the base of the LEDs.
Software for the LED Shield
- Compass - Shows which way is north based on the current direction of travel
- PointFinder - An extension of Compass, displays the course to a way-point
- PathFinder - An extension of PointFinder, displays the course through a series of way-points
LED Addressing in Software
Since updating 8 LEDs can be cumbersome when displaying directions or data, I wrote a function to simplify addressing. To change the LED display a byte (a number between 0 to 255) is sent to a helper function called updateDisplay.
Each binary bit of that byte represents one of the LEDs, starting from the top and working in clockwise order. A bit of 0 means the LED is off, and a bit of 1 means the LED is on. So to illuminate every other LED the code is updateDisplay(170), where 170 is 10101010 in binary or on,off,on,off,on,off,on,off.
This is advantageous from changing every LED individually since the eight lines of code for individual addressing can be turned into one line and a supporting function.
The upateDisplay function is available for download below.
| Attachment | Size |
|---|---|
| updateDisplay.pde | 1.13 KB |
- 138 reads


Comments
Post new comment