| I have an idea... but I'm not sure if there is some conceptual problem that might make components blow up...
How it's meant to work:
- In the entire circuit, there are four 'rows'.
- Each 'row' has three 'cells'.
- Each 'cell' has an LED and a n/o pushbutton switch.
- The controlling lines:
- The top line is capable of sourcing enough current to power a whole 'row' of LEDs, and can be switched high or low.
- The bottom lines are general-purpose I/O ports on a microcontroller, and can be set as high/low outputs, or high-impedance (input).
- The top line is high when displaying LEDs, and low when reading buttons.
- The microcontroller can set which row it is 'looking' at by setting which ONE of its lower 4 lines high.
- To read all the buttons, the microcontroller sets the top line low, then:
- Sets the first of the bottom lines HIGH, and the rest to inputs.
- Reads the button state (1=on,0=off)
- Sets the second of the bottom lines HIGH, and the rest to inputs.
- Reads the button state (1=on,0=off)
- ...
To display a LED pattern, the microcontroller sets the top line high, then rapidly:
- Sets the first of the bottom lines HIGH.
- Sets the remaining lines to LOW if lit, high-impedance if not lit.
- Pause for a brief moment.
- Sets the second of the bottom lines HIGH.
- Sets the remaining lines to LOW if lit, high-impedance if not lit.
- Pause for a brief moment.
- ...
- Repeat as long as the pattern should be shown
Whaddaya think?
If you're quite confused, read this about charlieplexing - the technique this is derived from. |