What sort of strategies do y’all use for cycling through animations? There’s the obvious time based. Right now I’m considering using a basic pushbutton, but was wondering if anyone had any simpler or creative ideas, especially for manual animation rotation.
I’m using a rotary encoder, so I can go forwards and backwards through my effects array. The Teensy Encoder library works well.
The encoder also has a pushbutton action when you push the stem, so I also have it set up to change the brightness when I push the button down and turn.
Ooooooohhhhhhhh that sounds awesome. Wish I’d thought of that.
I use two different methods. The first one is “elapsed-time” where I will simply change the effects after x-amount of time has passed. This can be a fixed time, say every 10 seconds, or a random value, say between 5 and 20 seconds. If there’s an SD card in the project, then I will also use a physical file that stores timing values for each effect. The latter is good for creating effects that are tied to music for example. I will always include a manual “advance” button as well, to skip an animation.
Let your animation functions only send one frame per call and have a very short interrupt routine changing one byte value only (the program number) if a button is pressed. That allows both high fps and immediate reaction on input…
I use a button along with the EEPROM to save the current function. If you turn it on it reloads the last pattern and does not cycle. Hit the button once and it begins to cycle at timed intervals. Hit the button again the timing stops and then you can advance to a particular pattern by continuing to push the button. I just check the button prior to every show() to avoid interrupts.
I use an interrupt so that I don’t have to wait for a .show() to come up.
My main loop runs as fast as it can, no delays, no hangups. Each effect has its own timing delay in them, so rather than waiting for that to expire for the next frame to be displayed, I just have the interrupt fire whenever I push the button. I should also mention that I use LPD8806 exclusively, so I don’t have to worry about interrupts being disabled by FastLED.