Please refer to my previous blog for the completed circuit for the RGB LED animation. In the previous blog we are showing 3 primary colors( red, green, and blue), but in this project we will show ALL 16 million colors. The program below is the code for showing 16 million colors.

int redPin= 11;
int greenPin= 9;
int bluePin= 10;

void setup()
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);

void loop()
for(int red=0; red<255; red++)
  for( int green=0; green<255; green++)
    for( int blue=0; blue<255; blue++)

Obviously, we are not writing all 16 million lines to complete the program. We are using a for loop to write a few lines to show all 16 million colors. In the program above, you can see 3 nested for loops to set a value for 3 different pins.

2 thoughts on “Tutorial 3: RGB LED 16 million colors

    1. I tried to take a video of the RGB LED changing colors, but it is hard to see the colors changing because it goes too fast. It is changing 1000 colors in 1 second. To see all 16 million colors, it will take more than 4 hours.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s