TickerScheduler
TickerScheduler copied to clipboard
Examples of using TickerScheduler
Hello all, could anyone be willing to provide me with a sample of how they used the TickerScheduler. I would really appreciate it.
Thank you in advance.
https://youtu.be/Au68C3I5B30
Can someone explain the reason for this line in the example blink?
ts.add(0, 1000, [&](void *) { blink1(); }, nullptr, true);
[&](void *) { blink1(); } ?
Hey @QuitButton!
It's called a lambda expression, this is how you define a function object inplace for TickerScheduler to execute.
You can have multiple calls between the curly braces just like any other function:
ts.add(0, 1000, [&](void *) { blink1(); blink2(); blink3(); }, nullptr, true);
Hope this clears things up :)
Here's some further reading: https://en.cppreference.com/w/cpp/language/lambda https://docs.microsoft.com/en-us/cpp/cpp/lambda-expressions-in-cpp?view=msvc-160
Ok thanks. I'll be honest - I don't understand it, but I can at least use it to call a function, which is all I need.