Advertisement
Guest User

Mbed OS Ticker

a guest
Nov 24th, 2016
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <mbed.h>
  2.  
  3. DigitalOut led(LED1);
  4. Ticker heartbeat_interrupt;
  5.  
  6. /**
  7. * @brief Simple heartbeat function.
  8. */
  9. void heartbeat(){
  10. led = !led;
  11. }
  12.  
  13.  
  14. int main()
  15. {
  16. heartbeat_interrupt.attach(&heartbeat, 1.0); // the address of the function to be attached (heartbeat) and the interval (1 seconds)
  17.  
  18. while(1){
  19. sleep();
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement