Test of Ticker interface

Dependencies:   mbed

Ticker interface: https://developer.mbed.org/handbook/Ticker

Files at this revision

API Documentation at this revision

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
--- /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
--- /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