Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # How to pass a callback function as an argument (Arduino, C++)
- This makes use of the `std` C++ library
- ```cpp
- 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);
- }
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement