I made a project that has multiple effects for neopixel devices. They are contained in their own files and imported in main.cpp. Currently I just comment out unused effects, but I would like to control them over MQTT. The effects need to run in an infinite loop but should be cancelled immediately when a new command arrives.
So I was thinking about using async to have a main loop that just checks every tick for new commands and then keeps executing the effect.
I read that you do this with futures in CPP, but I can’t include or find that library nor find any docs on that. Is it even possible? Should I make them stateful classes and have a tick function that I call manually each time after doing the checks?
BTW I am absolute CPP noob, only used python and typescript so far.