Hello,
I have come across a problem using FastLED and Onebutton library.
I'm trying to set each LED, different hue value(which changes over each iteration(10 ms)) when button is pressed(Long click). Here is my code:
I have defined LC so when longclick is activated, the if statement turns true and causes the hue value to change. But when I press the button the if statement runs once and somehow it doesn't run afterwards. So I get LEDs with different hues; But hue values remain the same and I get same hue through different iteration for each LED.
I'm really new to c++ and arduino(started 30 hours ago). I have tried to search the solution of my problem. But sadly I couldn't find any solutions. I hope you can help me.
Thanks,
It's a macro defined in the FastLED library. It's used in a lot of their example sketches. It repeats the code following it on a given interval. Almost certainly uses millis()/blink without delay technique behind the scenes.
It's clever. I suspect it boils down to each use of the macro creating a static unsigned long variable with either a unique name or the same name but a very localised scope, which gets compared with millis() to see if it's time to run the associated code lines.