Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: Eco19R on June 10, 2007, 06:14:33 PM
-
Hey - I had a quick question,
Is there a way to control a Bi color LED with only one pin on a MCU?
I was thinking that you could have it hooked up like this
+5V
|
Resistor
|
MCU-- Resistor--------- >LED>
|
Resistor
|
GND
If the MCU pin was set to input, the led would be off
if the MCU pin was set to high the LED would be one color
if the MCU pin was set to low the LED would be a different color
Would this work?
Thanks for any information you can provide.
-
in theory yes but I have been proved wrong before the only sure way to know is
to test it.
-
bi color LEDs don't work like the way you are describing, they have two anode leading to one cathode (or vice versa), cathode must always be ground for either to work
(http://www.lc-led.com/products/n500tgb4d-c.gif)
if you use a inverter on one pin you can switch between the two using one I/O but you cannot have both off
unless you have one of those weird ones you have to charlieplex, in which case you would still need two I/O to work (your diagram confused me)
what you are discribing is something like two diodes pointing in one direction, in which case you can have either both on, one on, or the other one on, it is impossible to turn it off as if the control pin is high-z state (or input state), current will flow right through both diodes at once
-
Actually the bi color LED I am referring to only has two leads - its like two LEDS in one connected in parallel with reverse polarities.
Input state = high Impedance = no current would flow through LED,
Low = Current would flow through LED into MCU.
HIGH = Current would flow through LED to ground.
I think it would work - as long as the resistor values are correct.
Can anyone else share any insight into this subject?
-
it will work if you connect it like this:
+5V
|
Resistor
|
MCU -----------<LED>-----+
|
Resistor
|
GND
-
it will work if you connect it like this:
+5V
|
Resistor
|
MCU -----------<LED>-----+
|
Resistor
|
GND
Thats what I was trying to draw -
I have bad ASCII art.
Also both resistors would be the same Ohm value correct?
Thanks for the help
-
if you only want two states, why not just get a normal on/off LED? :P
-
Its 3 states....
Off,
On with one color,
On with a different color
Also if you switch back and forth between them at a high speed you get a 3rd color.
-
well the point i was trying to make is that digital output pins on a MCU only have two states, meaning your LED can only have two states . . . so no reason to have anything other than a two state LED . . . :P
you will need an extra MCU pin to use all three states of a 2 color LED (color A, off, color B)
-
well the point i was trying to make is that digital output pins on a MCU only have two states, meaning your LED can only have two states . . . so no reason to have anything other than a two state LED . . . :P
you will need an extra MCU pin to use all three states of a 2 color LED (color A, off, color B)
Nope some MCUs have 3 states, High, Low and High Impedance, which is when its set to input
The circuit Ro-Bot-x drew would allow you to control a bi color led with only one MCU pin.
Eh - I am gonna try it and post back what happens,
-
oops I should have read the entire post . . .
I stand corrected :-X, never thought of doing that before . . .
be careful of the power draw through your MCU in the high state . . .
-
Eh, If I burn a 3 dollar chip I'm not out much, I will post back later and tell you if it works.
-
Its working great -I can get all 3 states just fine!
Red, Green And off
-
Great! What values did you use for the resistors?
-
I just used two 1k Ohm, Its not super bright but its defiantly visible,