![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test of Ticker interface
Ticker interface: https://developer.mbed.org/handbook/Ticker
Diff: main.cpp
- Revision:
- 0:be44cd8797f6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 05 10:42:22 2015 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); +Ticker ticker1, ticker2; + +void myFunc1() +{ + pc.printf("ticker1\n"); +} + +void myFunc2() +{ + pc.printf("ticker2\n"); +} + +int main() { + ticker1.attach(&myFunc1, 1.0); // call myFunc1 every 1.0 seconds + ticker2.attach(&myFunc2, 2.0); // call myFunc2 every 2.0 seconds + + // main loop + while(1) { + pc.printf("main loop\n"); + wait(5.0); + } +} \ No newline at end of file