Or not - as the case may be. This is my attempt to revive an old, bust Christmas decoration.
The original Christmas candle decoration was a white casing, simply filled with static, old-school filament lighting - and as happens one of them went by the by. We don't keep spares as most of our decorations today are LED. I was left with an empty shell - what to do?
As it happens I had a roll of serial LED strip lying around looking for a job - so last night I set about giving it one.
In the early days of putting together my software for the ESP8266 (see Home Control 2016 project - binaries available), once I'd managed to get serial LEDs to run properly, I put together several RGB controls one of which includes animation, but never actually used it until now.
The programming below is easy once you know how.
The first line stops any animation and clears out any queue. The second line starts up the yet-to-be-defined animation and defines which GPIO pin to use on the ESP and how many LEDs are involved (to set up the buffer which is number_of_leds * 3 - not that you need to know that).
The remaining lines start operating in the background as soon as they are called... here's the format:
rgbadd led_number, led_count, r, g, b, delay_in_ms
Hence any decoration such as the one in the video - which is nothing more than a strip of around 94 LEDs, starting where the wire comes in at the bottom and following the profile, pointing inwards (inside the hollow container) until coming back to the bottom. So, the first 8 and last 8 LEDs are set to green, the rest being red APART from half a dozen at positions 30 and 60 which get some animation between yellow and white.
You could do a LOT more and the software has enough storage for 300 LEDs and a lot more instructions than this, 600 in total (version 1.70 onwards). I've used around 180 here. I could make it considerably longer but that seemed like a reasonable size at the time.
In the above example, you would simply fire out these commands from the serial port – in my case I wanted to do this at the push of a button on the mobile phone.
Using Node-Red, I simply made a sequencer to send the instructions out one group at a time – you need a slight delay as the board takes time to process each command – only a tiny delay in milliseconds – but some.
Below are the two VERY crude functions to let me start up the display from the phone – or from a Node-Red Dashboard button.
Basically a payload of "reset" starts a crude global counter and iterates through the array, sending out messages at 100ms intervals until it falls off the end of the array (well, I was in a hurry). Works a treat. I have a test button there in Node-Red itself and a button on the phone, both of which do the same thing.