Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. # How to pass a callback function as an argument (Arduino, C++)
  2.  
  3. This makes use of the `std` C++ library
  4.  
  5. ```cpp
  6. bool myCallback(int value) {
  7. // here your custom logic
  8. return status;
  9. }
  10.  
  11. void myFunction(std::function<bool (int)> callback) {
  12. // here your custom logic
  13. bool status = callback(3);
  14. }
  15.  
  16. void loop(void) {
  17. myFunction(myCallback);
  18. }
  19. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement