digital i/o connected to +5v?


I took apart a LED-waving toy. It has 7 LEDs. There are 8 wires coming out of it. I assumed one was a common ground, and the rest were the positive leads.

It's actually the other way around, though. They share a common positive connection, with a different ground wire for each LED. I can turn each LED on individually by putting the common positive lead through a resistor into a +5V terminal, then touching the LED's ground onto GND.

I'm hoping to control these through the digital I/O pins. Normally one would apply either 0V or +5V to the pin. That would correspond to off and on (normally).

In this case, if I put the common positive wire in the +5V and an LED's ground into a digital I/O pin, the LED is on when the pin is low, and off when the pin is high.


Is it okay for a i/o pin set high to be connected to the +5V pin? They're the same voltage (more or less), which means very little electromotive force(right?) (and not much current with a resistor in the way). Is that okay?

When the LED is on, the i/o pin would be low, which means the current is flowing "backwards." (It seems that the +5V pin would be essentially 0V, and the 0V i/o pin would be essentially -5V). I don't know if I'm getting that right. Is it okay to do that?

If these things are okay, then I'm worried about running multiple LEDs when there's a common ground. That means the current per LED goes down as the number of LEDs lit at once increases? How's my logic there?

Thanks for your time. I'm quite new to this and I appreciate any help.

i had the same problem with the rgb led's i got from my source, they gave me common ANODE led's which means whichever ground pin i connect, thats the light that comes on, so i had 3 ground pins and 1 anode pin.

so heres what you do, connect the positive side of the led to 5v, then connect the negative to a resistor, i'm not really sure what value, sorry... ( i'm guessing 1k - 10k ohm is fine ) and when typing up the code, set the pin to LOW and it connects the led to ground, making it turn on, and setting it to HIGH will turn it off, and with a resistor, there should be no damage, and i did test this with my arduino...

p.s before you set an i/o pin to high or low, it floats, which means it's not connected to ground or 5v, so no worrys about it being turned on in the beginning!

p.p.s for rgb led's and and multiple pin led's, use multiple resistors, dont be lazy, use a resistor for every i/o pin you connect to led lead.

hope this helped! -big93

You can source voltage with the arduino but it's not much. Enough to toggle a transistor or light up an LED. It's actually safer to sink (ground) current with most any digital part since they can usually sink more than they source. You'd have to dig into esoteric literature to find out why.

Here, again is a calculator for LED resistance values to current limit a single LED. If you're happy with 10k use it, the LEDs will last MUCH longer.