two leds with one pin ie. when pin high ledA on, when pin low ledB on?

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!

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)

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.

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.

Great thanks all for the replies :slight_smile:

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

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

No. :frowning:

My bicolor red/green LED's have 4 independent pin connections. That's why I could connect them in series.