How I can I pass a function with arguments in Time out (like the code below):
Timeout flipper;
void flip(int x) {
pc.printf("%d", x)
}
int main() {
flipper.attach(&flip(2), 2); // I want to pass an argument here but compiler gives an error
while(1) {}
}
Timeout’s attach function expects a Callback<void()> function so I’m afraid you cannot pass it argument(s) directly. However, you can use global variables (shared memory) for that.