Fading the RGB LED was fun to figure out but it was too “blinky” to use for most things I could image. I wanted to have it fade smoothly through the available spectrum AND stay at a constant brightness. Here is the slightly-more-zen-less-blinky RGB LED:
The code below is an update of the previous code. It uses a very simple normalization method – just scale everything by the same amount to reach a target brightness.
By the way, this was developed on codebender and I’d like to say thanks to them for the excellent site and tools. In fact, you can run the code below on your arduino directly from this page.