- Discrete LEDs
- Dot/Bar LEDs
- Matrix LEDs
- 7-Seg LEDs
- Serial -- Software
- Serial -- Hardware
- RS-232 via the MAX3232
- I2C -- EEPROM
- I2C -- DS1307 Real Time Clock
- 1-Wire -- DS18B20, Powered, Single-Drop
- 1-Wire -- DS18B20, Powered, Multi-Drop
- 1-Wire -- DS18B20, Parasitic, Multi-Drop
- TI Link Protocol -- Calculator Demo
- Infrared Communication
- MIDI -- Output Demo
- MIDI -- Input Demo
- MIDI to Analog Synth
If you examine the photo here carefully, you'll note the rugged arcade-style joystick mounted for testing purposes on a piece of scrap wood. It's digital in nature, meaning that it is fabricated around four switches. Pressing the joystick one way or another activates the switches for the cardinal directions: north, south, east and west. And pushing between two consecutive directions activates two adjacent switches simultaneously, yielding the additional settings: NW, NE, SW, SE.
Incidentally, I picked this unit up dirt-cheap as surplus from All Electronics several years ago.
Continuing your scan of the photo, observe the eight LEDs which indicate the eight directions possible. Since only one is lit at a time, a single current limiting resistor is all it takes. Here's the schematic:
I think the source code will startle you; it's amazingly short and to the point! It boils down to little more than complementing the input bit pattern (negative logic, since I'm using pull-up resistors on the joystick switches), squashing the bits together from port lines A.0, A.1, A.6 and A.7, and then looking up the desired LED from an indexed constant array. All very straightforward Pascal!
Click to get the source code.
Click to get the schematic PDF.
Next Project: Rotary Binary Switch