Control 8 LEDs with only 5 output-ports?

Hello

Let's say I only have 5 output-ports left to use and I want to be able to control 8 LEDs individually. So, basically I want to use 4 of the ports to control the LEDs and the last port as a switch deciding which 4 of the LEDs to be lit.

Anyone know if this is possible and which parts I need to make it work? If it gets any easier, It's OK if only one of the LED (or half of them) can be lit at the same time..

You can do a board search for "multiplex" for a lot of similar post. If you have 5 output pins available, you could use a 74HC259 latching multiplex chip to do the job.

Take a GOOD look at this board:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1268441497

This is how you wire up the leds
You can only blink, one led, one column, one row at a time or all leds at a time.
BUT by switching fast between leds, you can make it appear that a pattern of leds is lit, thats the way most people do it.

David
[edit]You need 6 pins min, sorry. Buy multiplexer[/edit]

Not exactly what you've asked for but maybe charlieplexing?

In fact with N pins of a microcontroller you can potentially drive N * (N - 1) LEDs.

Jeroen

use a 74hc164 shift register, 2 wires

were only talking 8 leds here guys not making a video display :wink:

Simplest way to connect 8 LEDs to 5 pins:

You can control up to 20 LEDs with 5 pins using charlieplexing.