Bi-Color LEDs with Arduino

A few years ago I bought some bi-color or dual-color LEDs. These are LEDs that have only 2 leads like regular LEDs, but can display 2 colors.

An LED is a type of diode, so it only allows electricity to flow one way through it. But when that electricity is flowing, it lights up.

The bi-color LEDs are essentially 2 of these in one package in opposite directions.

With an Arduino, you normally connect one end to ground and the other end to a digital pin and just write a HIGH to that pin to light the LED.

I wasn’t sure at first how to use the bi-color LEDs with the Arduino, but it turns out it is simple. All you have to do is connect each end to a digital pin and write LOW to one and HIGH to the other. Reverse them and it lights in the other color.

This works because writing LOW sets the pin to 0V just like writing HIGH sets it to 5V. This means that one at LOW and one at HIGH creates a voltage drop across the LED, lighting it up.

Turns out it is nice and easy.

Leave a Reply

Your email address will not be published. Required fields are marked *