Questions tagged [lambda]
3 questions
1
vote
1 answer
Using lambdas as callback functions
Using the Ticker library for the ESP32, how can I use a lambda as an argument to the attach method?
tickerSystemManager.attach(1000, [&](){
systemManager->sync();
});
Attempting to use the above, I get the following error:
Matrx.cpp:11:4: error:…
Matt Clark
- 580
- 4
- 15
1
vote
1 answer
How do I use lambda functions in Arduino?
I want to pass a lambda function as an argument to a method. Example:
T reduce(const T initial, const std::function acc) {
T value = initial;
for (size_t i = 0; i < S; ++i) {
value = acc(value, this->values[i]);
}
…
Arseni Mourzenko
- 246
- 1
- 3
- 11
0
votes
1 answer
Use callbacks in Arduino with pointers to functions (will functions persist in memory?)
As I been learning Arduino (micro controllers, c++, etc) I have learned that memory is very limited. I already understand how memory works when it comes to variables. But I do not understand how memory works when it comes to functions. Since I am a…
Tono Nam
- 966
- 1
- 10
- 22