2 LEDs and input/tri-state com

BrendanP

Senior Member
Hi all, I've been off the forum for a while but am still busy with electronics.

I'm using a smd 40X2 in a project under design and have run out of I/O's. I need to run several status indicator LED's.

It occurred to me that it might be possible to run 2 LEDs of single pin by using 1 LED with its cathode to the pin and the other with its anode, and the other lead of the LED to either ground or supply. Then by either either high or lowing the picaxe pin one or the other LED will light or by setting the pin as an input neither will light.

Is my thinking correct on this? Breadboard test is next.
 

BeanieBots

Moderator
Should be possible with a little thought and care.
Depending on the LED colour (and hence Vf), you might need to add in some series diodes (plus the obligitory resistor) with each LED to maintain consitant brightness between them and also to prevent both being on when the I/O is tri-stated.
 

hippy

Technical Support
Staff member
The other trick is to wire them anode-to-cathode as a parallel pair between pin and the centre tap of a resistor divider network between 0V and +V. That's how a two-colour LED would usually be used.

Connected to a PWM pin you can have them both off, one or the other on, or both on at the same time (brightness will be affected but perhaps not really noticeably so ).
 

slurp

Senior Member
Connected to a PWM pin you can have them both off, one or the other on, or both on at the same time (brightness will be affected but perhaps not really noticeably so ).
I can picture one or other on simple high/low output and both with an aternating output but I can't picture both off.

Can you explain how this is achieved?

Best regards,
Colin
 

hippy

Technical Support
Staff member
Tri-State ( input ) means minimal current through the LED so none lit.
 

slurp

Senior Member
Tri-State was what I meant to write when I said High State.

A very smart solution to indications, thanks for that.

Best regards,
Colin
 
Top