Go Down

Topic: two leds with one pin ie. when pin high ledA on, when pin low ledB on? (Read 800 times) previous topic - next topic

dtokez

Hi all, I have seen the circuit used before, but can't think of how it could be done. If I recall it was a set up in which current only flowed through one led on each shared input state?

I want to control a red and green led with one pin. When the pin is high I would like to light a red led and when its low I would like to light a green led.

Hope that makes sense!

Osgeld

when a pin low its essentially connecting to ground, so the red led would go from arduino to ground, the green would go from +5 to arduino (dont forget your current limiting resistors)
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

Techone

Quote
I want to control a red and green led with one pin. When the pin is high I would like to light a red led and when its low I would like to light a green led.


Easy. Use a NOT gate, like 74LS04 or any 74XX04 or 4049 or 74XX00 <-- NAND gate. 

bibre

Quote

I want to control a red and green led with one pin. When the pin is high I would like to light a red led and when its low I would like to light a green led.

Hope that makes sense!


Yes it does.

Connect like this:
+5v to R1 (330 ohm) to green LED anode.
Green LED cathode to red LED anode and to Pin.
Red LED cathode to R2 (330 ohm) to ground.

And ... that's it!

You can even turn it YELLOW (green & red together) by changing the pin to an INPUT (high-impedance) and the current will flow thru both LEDS (which will be a little dimmer than when they are green or red).

I am using this 3 color scheme for my model railroad signals, only I use HIGH for green, LOW for red and INPUT for yellow.

I hope it helps.
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be


dtokez

not possible to do this with a 2 colour common cathode or anode led is it?

bibre

Quote

not possible to do this with a 2 colour common cathode or anode led is it?


No.   :(

My bicolor red/green LED's have 4 independent pin connections. That's why I could connect them in series.
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

Go Up