Keiji Muro
/
myTickerTest
Test of Ticker interface
Ticker interface: https://developer.mbed.org/handbook/Ticker
Revision 0:be44cd8797f6, committed 2015-05-05
- Comitter:
- 66keg
- Date:
- Tue May 05 10:42:22 2015 +0000
- Commit message:
- first commit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r be44cd8797f6 main.cpp --- /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
diff -r 000000000000 -r be44cd8797f6 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue May 05 10:42:22 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8ab26030e058 \ No newline at end of file