Right, after a week, it’s time for me to start contributing to this community rather than asking questions or plugging my Android Wallpaper!
This is the first in an occasional series of ‘tutorials’ (for want of a better term), about how I’ve gone about constructing my light patterns.
I’m new to FastLED, and this is the first of my conversions of my patterns to the library. I’m not an expert coder, and there is some overlap of existing functions in FastLED. (In fact it would be great if someone could fully convert this for maximum efficiency!) Please refer to my GitHub code at:
I have a love of light patterns that look natural. Some patterns to me are very clever with their interacting sine waves etc., but don’t actually look aesthetically pleasing (to my eyes!)
Something I noticed about switching an incandescent light bulb off was that unlike an LED, it fades out. It doesn’t fade out linearly (255, 254 to 0). It actually fades with a natural geometric progression.
So I built a simple function that would handle my switching off for me, instead of just switch off an LED. The idea is really simple - it’s just a table of geometrically decaying values, so an input of 0 returns 255; 1 = 223 etc… (lines 144-152)
(255, 223, 191, 159, 127, 111, 95, 79, 63, 55, 47, 39, 31, 27, 23, 19, 15, 13, 11, 9, 7, 6, 5, 4, 3, 2, 1)
Using this to switch an LED off makes it look much more natural.
Next, I was on holiday in Paris and I loved the flashing strobe effect of the Eiffel Tower. The main thing I noticed was that the flash location seem quite even. It didn’t repeat a bulb soon after it had already gone off (At least it seemed this way to me). So in my quest to imitate the Tower, I wrote some code that would choose a random LED, but not repeat until they were all done. It filled an array with all the values of the number of LEDs, and then shuffled them randomly (lines 32-41)
So I combined these two ideas to make my Strobe Fade effect! The LEDs flash randomly, but fade off pleasingly.
Not satisfied with that, however, I wrote some variations… (in my code - on line 45 - try any value from 0 to 8 to see them all)
The first thing I tried was, rather than white - flash a colour!! (boring…) - [variation 0]
The next thing was to cycle through the rainbow - pretty, but still a bit humdrum [variations 1 to 4]
(a quick note about 2-4: My hue algorithm has an option not just to cover the entire colour hue wheel (Adafruit’s original code, I think), but also allows you to do just one of the ‘lines’ between the primary colours (e.g. Red to Green to Red)
I hit pay dirt when I had the idea of using a fixed colour for each flash, but the decay shifts the hue slightly each time [variations 5 to 8]
Try out variation 8 for my pride and joy!
Thanks for reading!
(AFIK, but am always willing to be educated!!) Anyway my point is that I’d still apply gamma correction on top of my table to make it more natural - the very end is still a bit sudden to my eye…