Go Down

Topic: NeoPixel Code Generator (Read 6231 times) previous topic - next topic


Mar 09, 2018, 04:17 pm Last Edit: Mar 12, 2018, 06:00 pm by Adrianotiger
I was wondering how much people like the Arduino together with the WS2812 led strips, as you can create a lot of nice effects and items (3d print) with less than 10$.

Once you have to program the Arduino, it begins to be more complicated if you don't find the code ready to use.

So I begun to write a simple led strip effect generator, where you can set how many strips you want and give an effect for each strip.

It is still in development, but if this can help someone, I can put it on github (so everyone can create new effects).

You can test it here:

How use it:
- Click on "Add Led Strip"
- Select Arduino Pin and leds quantity.
- Press "Add Effect"
- Choose "Rainbow"
- Press "generate Arduino code" to get a copy-paste code

Transitions between effects would be a nice feature for the future. I am still trying to see if it could be something helpful or not.



Well done job!

Github would be nice as other people can co-develop it.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Nice, just used it for my clock.   Save a bunch of time from having to code it myself.   I think it is a great tool!


Mar 12, 2018, 05:52 pm Last Edit: Mar 12, 2018, 06:00 pm by Adrianotiger
Thank you for the feedbacks.
It is now on GitHub :)

I need to add a save/load button to save it as XML, add other 2 important effects and add transitions between the effects.

The link is:


Tam Koowan

Bonjour, c'est un super boulot, pensez vous qu'il serais possible de rajouter des fonctions ?
Ex : bouton, accéléromètre etc... ?

Une interaction sur les néopixel pour modifier les effets en temps réel et non juste par les boucles du programme ?

Hello, this is a great job, do you think it would be possible to add functions?
Ex: button, accelerometer etc ...?

Interaction on neopixel to modify the effects in real time and not just by the loops of the program?


Yes it would be possible. But not in this page. Maybe on a fork or on another page since this was wrote to loop.

I wrote it thinking at that. So you have only 1 function in your loop. If you add some sensors or buttons, you can easely add a switch to your loop and execute the wanted loop depending on the button or sensor you activate.

But would not be difficult to integrate it on this project :)


The outputted sketch code causes compile errors if you use the rainbow effect and adjust the parameter sliders, and/or specified a different number of LEDs in the strip to the default setting.

The problem appears to be because the mathematic equation you're passing those parameters to, does not always produce a whole number (integer), but the NeoPixel library is expecting an integer - it does not know how to address LED number 19.888!.

I think the solution is to simply round up the numbers to integer values before using them as parameters to call the NeoPixel library. You can do this by either rounding up the variable after it is output from the equation:
Code: [Select]
NewVar = Int(OldVar); (Where OldVar is your resulting variable from the equation,
By declaring the variable as an unsigned integer type from the outset:
Code: [Select]
Unsigned Int x = 1;

Go Up