More Colors

I imagine you are less than impressed by the cyan glowing LED before you. To display a different color, change the color in the code to one of the others:

     setColor(ledDigitalOne, CYAN); -> setColor(ledDigitalOne, newColor)

Display a Random Color

Of course we can do more than display a constant color. To see how we can cycle through random colors, change the loop() code to:

void loop() {
  //setColor(ledDigitalOne, CYAN);

Analog Color Control

While switching between colors is good fun, RGB LEDs really come into their own when mixed with analog control. Using PWM (pulse width modulation), it's possible to produce nearly any color and fade between them. Sadly, the code for this is a bit too long for the section above, so click below to see the code: 

This guide was first published on Aug 18, 2017. It was last updated on Aug 18, 2017.

This page (Make It Better) was last updated on May 08, 2021.

Text editor powered by tinymce.