kimito / Mbed 2 deprecated HelloInterruptedWorld

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kimito
Date:
Sat Oct 11 11:45:38 2014 +0000
Parent:
1:03c191369089
Commit message:
initial 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
--- a/main.cpp	Sun Jan 01 20:57:57 2012 +0000
+++ b/main.cpp	Sat Oct 11 11:45:38 2014 +0000
@@ -1,12 +1,34 @@
 #include "mbed.h"
 
-DigitalOut myled(LED1);
+class Flicker
+{
+public:
+    Flicker(PinName pin, float interval)
+        :_out(pin),_interval(interval) {
+        _out = 1;
+        registerNextFlick();
+    }
+
+    void flick() {
+        _out = !_out;
+        registerNextFlick();
+    }
 
-int main() {
-    while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
+    void registerNextFlick() {
+        _timer.attach(this, &Flicker::flick, _interval);
     }
+
+private:
+    DigitalOut _out;
+    float _interval;
+    Timeout _timer;
+};
+
+
+
+int main()
+{
+    Flicker f1(LED1, 0.5);
+    
+    while(true){}
 }
--- a/mbed.bld	Sun Jan 01 20:57:57 2012 +0000
+++ b/mbed.bld	Sat Oct 11 11:45:38 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/078e4b97a13e
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file