Hello World for Timeout

Fork of Timeout_HelloWorld by Mbed

Use

The Timeout API is a countdown timer that triggers a callback function when the timer runs out. The Timeout interface can be though of as a one shot Ticker.

API

API reference.

Import librarymbed

No documentation found.
Revision:
0:8a555873b7d3
Child:
2:50216cc75b4a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Feb 15 14:39:20 2013 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+ 
+Timeout flipper;
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+ 
+void flip() {
+    led2 = !led2;
+}
+ 
+int main() {
+    led2 = 1;
+    flipper.attach(&flip, 2.0); // setup flipper to call flip after 2 seconds
+ 
+    // spin in a main loop. flipper will interrupt it to call flip
+    while(1) {
+        led1 = !led1;
+        wait(0.2);
+    }
+}
\ No newline at end of file