Adafruit Neo Pixels: Programming Color Changing Effects
For this little electronics project, I wanted my cosplay prop to do some cool color changing effects.
But, I didn’t want all the colors of the rainbow this time. I wanted the prop to glow from blue and green to purple.
So this did take a decent amount of trail and error and I didn’t find anything online which worked just right. So I have taken it upon myself to share what I have learned. I hope this saves you time and effort!
Disclaimer: I’m pretty new to Arduino projects and I’m a beginner programmer at best. I do have friends who are engineers who helped me get on the right track. While there are several aspects of the library that I don’t understand fully, the scene works and the program does what I want to animate the LED’s in my prop! Good enough!
To begin! I am using an Adafruit Itsy Bitsy 32u4 ardunio chip for this project. I am also using neo pixel LEDs also from AdaFruit.
The library I am using to program the animation is the Adafruit_NeoPixel.h library.
Choosing the Colors:
First, to limit the colors and exclude the reds and yellows I updated the Wheel strip.Color parameters as follows:
I found this AdaFruit NeoPixel Uberguide to be helpful in selecting my colors as well. The great thing about this is that I know I could do this for other parts of the color wheel too. If I just want warm colors like red, orange, and yellow, I can select the starting points and colors to cycle through different parts of the rainbow!
I also suggest using the colorWipe function to help select colors. I did end up keeping this function in the scene for my cosplay prop.
Changing the Direction:
Next problem is that the green, purple, and blue colors were beautiful, but they were marching in the wrong direction.
I needed to swap the direction of the animation in the rainbow functions so the colors would progress the way I wanted. I did a lot of searching about this topic, but nothing worked out of the box. I ended up doing a lot of trail and error. I am not fully certain why this works yet, but it does! My compiler does not complain either so it’s good to go.
Here are the two examples from the rainbow function and the rainbowCycle function that I used:
Other Adjustments
A couple other things I double checked were the brightness, and speed. Once I tinkered with those settings too, I was able to active the animation I wanted for my cosplay prop.
Here’s how she looks!