bool myCallback(int value) {
// here your custom logic
return status;
}
void myFunction(bool (*callback)(int)) {
// here your custom logic
bool status = callback(3);
}
void loop(void) {
myFunction(&myCallback);
}
bool myCallback(int value) {
// here your custom logic
return status;
}
void myFunction(std::function<bool (int)> callback) {
// here your custom logic
bool status = callback(3);
}
void loop(void) {
myFunction(myCallback);
}
Fantastic. this saves my time.