RGB LED

We can get LEDs in a variety of colors these days, but what about an LED that can change color? We all know that a combination of Red, Green, and Blue (RGB) can give us any color. Using the Arduino PWM functionality, we will see how we can obtain 16 million color combinations with an RGB LED.

RGB LED stands for Red Green Blue LED. Inside such an LED we can find one red, one green, and one blue LED, mounted together.

Getting ready

The following are the ingredients needed for this recipe:

  • An Arduino board connected to the computer via USB
  • A breadboard and jumper wires
  • An RGB LED
  • Three equal resistors between 220–1,000 ohm

How to do it…

Follow these steps in order to connect an RGB LED to an Arduino board:

  1. Mount the RGB LED on the breadboard.
  2. We need ...

Get Arduino Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.