Mixing Colours with a Duo-Red/Green LED

Hi tecsploiters!!

Im going for a short and simple post this time around with a quick look at some cool DUO-LED’s. For those of you that don’t know a Duo LED is a an LED that’s capable of making two colours, in this case the LED can be switched to red or green, or a combination of the two – giving a kind of amber glow.

Dual color LED

Dual color LED

They are super easy to use, the only difference between them and a normal LED is that they have 3 legs instead of the usual 2!, the LED’s i’m using have a shared negative leg in the middle, and a positive leg each side that controls the intensity of a color (one for green one for red).

You will see in my picture that I havn’t used resistors in series with the LEDs – I should be using 1K resistors here – but i wanted to make the LED as bright as possible, and im not worried about burning them out 😉

In order to demonstrate the colour changing I’ve created a little program for the STM32F4 Discovery that can be used to toggle the colour of the LED between red / green / amber as you can see in this video.

Amber Led

Amber Led

Looks like these would be perfect to make a little traffic light with!

The code can be pasted into the main.c file in my hello world example, and uses the GPIO pins PD3 and PD5

if anyone wants this as a full project let me know!

The code:

What are your thoughts?