The Studio of Eric Valosin

Friday, March 21, 2014

LED Cross Fade

As I've been working on my computer meditation for() loop project, the next step was to get the LED colors to fade from one to the next, rather than snapping right from one color to the other. This seemed like it should be really simple, but it proved to be rather challenging. Getting each color of the RGB LED to transition simultaneously, and at a controllable speed was the tricky part. (getting them to transition one after another was not too hard).

I looked online and couldn't find much of use that was versatile enough, except for this Arduino example which frankly just seemed way more complicated than it needed to be. However, I was able to use it as a template to create a much more concise version that allows the user to input not only the starting and ending colors, but also the duration and smoothness of the fade. I hope this is helpful to anyone who might be looking for something similar...

(Scroll to the bottom of the post for code you can copy and paste. If that's not working for whatever reason, you can find it here)

In the mean time...

A nice little package fortuitously arrived at my doorstep yesterday
So... I upped my pushbutton prayer bead prototype (see my prior posts in the link above if that makes no sense to you) to include 5 buttons, confirming that the process used to coordinate 2 and 3 buttons will work indefinitely!

No comments:

Post a Comment