2 color LED

Hey all!

I have a problem, how can i connect 2 Colored LED(red, green) with arduino, for example light green 1 second, turn it off, then light red etc.

Problem is middle wire is positive, and left and right wire is neg.

Only way to do this is to control ground output? But how?

Thanks.

And the LED

Dead easy!

If the center leg is positive, connect it to +5V. Then if you know the forward voltages for each color, calculate the necessary resistors using Ohm's Law:

R = (U - Uf) / I

Here U = 5V, Uf = ...datasheet or measured..., I = 0.02A

In case you can't get hold of the Uf values, take 1.8V for RED and about 2.6V for GREEN. This would give you values of about 160Ohms for RED and about 120Ohms for GREEN. In case of doubt, take the next larger value for R. If you don't want to do any math at all, start with a large value, maybe 270Ohms.

  • (center leg) 5V
    |
    |
    +-----------------+
    | |
    | |
    | |

\ / \ /


| |
| |
o (left leg) o (right leg)
| |


| | | |
| | R(green) | | R(red)
| | | |


| |
| |
o (1) o (2)

Connect (1) and (2) to two digital pins of your arduino board. When you set the pins to HIGH, the LEDs will be off (both sides 5V, no current going through), when you set them to LOW (GND) they will light up.

Big Thanks madworm!!

Got all to work now, pin1 must be LOW and pin2 HIGH, then green led is on and vice versa.