Programing - Stained glass windows project
This post is part of a series on the stained glass windows project.
In this project I am using a Wemos ESP8266 development board. This board supports micro python, C/C++ and the Arduino variant of C/C++ via ESP8266 core for Arduino. I decided to go with the ESP8266 core for Arduino because I was able to get it up and running quickly and I already had the tool chain set up for it.
I been using FastLED for the last few projects over the more common Adafruit_NeoPixel library. FastLED uses less memory, more compatibility with different hardware and leds, actively maintained and updated, build in gamma and color correction, faster math and memory functions like HSV2RGB, Good comunity, Good documtation
For each pattern, I create a legend image that shows the offset of each LED. This gives me a good reference making it easier to make patterns.
Then I created a series of sets for each different geometry within the pattern.
For example: Star #1 = 3,4,9,14,13,10,3. Star #4 = 27,28,31,38,37,32. Cube #5=15,16,20. Cube #8=24,25,33
Next I create a series of function for each type of pattern. The functions take a set of offsets, the transition speed, the color pallet as parameters. These parameters are randomized each time the function is called and should produce a different pattern each time the panel is started up. Theoretically there should be in the order of 65 million different patterns, but realistically there is only a few hundred visibly different patterns for each panel
All the panels share the same code base with a different series of sets. As I made more patterns all the panels should get more and more interesting.
All of the source code for the panels can be found on my github. StainGlassLaserPatterns
Leave a comment