Pages: [1]   Go Down
Author Topic: two leds with one pin ie. when pin high ledA on, when pin low ledB on?  (Read 729 times)
0 Members and 1 Guest are viewing this topic.
South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged


Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.   
Logged

Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: March 03, 2012, 11:40:31 pm by bibre » Logged

Billy     http://www.z-world.com/operations/gbremer/

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

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great thanks all for the replies smiley
Logged

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

No.   smiley-sad

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

Billy     http://www.z-world.com/operations/gbremer/

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

Pages: [1]   Go Up
Jump to: