Neo Pixel LED Code Breakdown!
Today I'm going to be going over some code segments from a recent video I made on using a neo pixel with Arduino. You can watch the video here: https://youtu.be/CPTLbmnqsGU
I plan to use this in a few other projects I have planned for Halloween! I hope you enjoy them and possibly build one yourself. Bur first I had to figure out how to use one with and Arduino. The great thing about the neo pixel line is the open source library which can be found here:
https://github.com/adafruit/Adafruit_NeoPixel
Once you have the library you have quite a bit of starting code to work with. This is where I was able to find the building blocks for the four Arduino sketches I have created. Fade Color and Fade Color Change I found the base code online here: https://gist.github.com/fenihel/835719d8f4af0d545242898bcb6a86c4
I then edited this to include a delay that helped smooth out the fade effect. I then copied it for a second color and edited the setLightsToBrightness method to intake a set of RGB values which then allowed it to change colors when I swapped between sets of fades.
This may not be the best way to perform this but it does work!
When it comes to RGB Values you can use a color slider like this:
https://g.co/kgs/GEJw3D
To help get different colors based on what you want. The values mix together to make 1000's of colors for whatever you would like. This is very helpful especially if your looking to get a certain color for your project. This is a great way to get lighting on costumes!
The other two are based on the neo pixel library sample code but I removed the rainbow change section and applied different color values to make a red green change. The great thing about the library is these functions that it already has are easy to work with and change to meet your needs. With this I am hoping to make some very interesting projects with a much more in depth break down of the code. This video was meant to be just a quick overview of the Neo Pixel as well as a learning tool for myself to make much more interesting LED effects for later projects. Please remember to like and subscribe to the channel for more content like this!
Until next time remember to stay Nerdy!!
Code: https://github.com/NerdManufactory/Arduino-LED
Comments
Post a Comment