# Newbie Multiplexing (I think) Help!

Hello,

(Is this the right place to ask this?)

I am familiar with programming, however I am new to electronics. I have a project where I need to light 17 separate LEDs and be able to control each one individually. However there are only 13 digital pins. What is the best way to deal with this?

Simplest is to use the analog pins as digital pins. A0-A5= D14-D19. Don't forget current limiting resistors on all pins to avoid damaging the arduino pins.

Or get some shift registers, such as 74AC299PC from Newark.com, 56 cents.

Thanks! never knew the analog pins could be used as digital pins!

Nekomancer: Thanks! never knew the analog pins could be used as digital pins!

The idea is simple. Analog out is PWM, about 500Hz. If you are writing 0, it will be zero out. If you are writing anything from 1 to 254, the output is anything else than 0 or clear 1. Just write 255 and it is 1. Easy

Do you know how PWM works? If yes, then it is easy. If not, ready this and it will be easy. http://en.wikipedia.org/wiki/Pulse-width_modulation Well, it looks hebrew for me, but just use 1 and 255, and are your 17 outputs at least

Cheers, Kari

You can also just use digitalWrite(A1, HIGH) rather than messing round with 255 each time.

tomm: You can also just use digitalWrite(A1, HIGH) rather than messing round with 255 each time.

And that was an information I needed, thanks!

Kari

Thats neat! I never thought about it in that way.

You don't need the analog reference at all if using as a digital pin.

signal_out = 14;

pinMode (signal_out, OUTPUT);

digitalWrite (signal_out, HIGH); or digitalWrite (signal_out, true); or digitalWrite (signal_out, 1);

will put out at a +Vcc signal (5V with a 5V supply) given that you have a proper current limit resistor

while digitalWrite (signal_out, HIGH); digitalWrite (signal_out, false); digitalWrite (signal_out, 0);

will all bring it low, given that you have a proper current limit resistor

LEDs can be driven as shown here