BreathLed demo

Dependencies:   BreathLed mbed

Files at this revision

API Documentation at this revision

Comitter:
steeven
Date:
Mon Apr 06 11:28:05 2015 +0000
Commit message:
init release;

Changed in this revision

BreathLed.lib Show annotated file Show diff for this revision Revisions of this file
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 66026ba8292a BreathLed.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BreathLed.lib	Mon Apr 06 11:28:05 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/steeven/code/BreathLed/#13c83a6b336f
diff -r 000000000000 -r 66026ba8292a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Apr 06 11:28:05 2015 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+#include "BreathLed.h"
+
+using namespace steeven;
+
+BreathLed leds[] = { BreathLed(LED1), BreathLed(LED2), BreathLed(LED3),
+        BreathLed(LED4) };
+const int n = sizeof(leds) / sizeof(leds[0]);
+Serial pc(USBTX, USBRX);
+
+/*
+ * Demo the BreahLed usage
+ * Press 0/1/2 on console to loop/on/off the leds
+ */
+int main() {
+    int i;
+    for (i = 0; i < n; ++i) {
+        leds[i].loop((i + 0.5) / 2, 0.3);
+    }
+    pc.printf("Press 0/1/2 to loop/on/off the leds\n");
+    while (1) {
+        switch (pc.getc()) {
+        case '0':
+            for (i = 0; i < n; ++i) {
+                leds[i].loop(i + 0.5, 0.5);
+            }
+            pc.printf("loop...");
+            break;
+        case '1':
+            for (i = 0; i < n; ++i) {
+                leds[i].on();
+            }
+            pc.printf("on...");
+            break;
+        case '2':
+            for (i = 0; i < n; ++i) {
+                leds[i].off();
+            }
+            pc.printf("off...");
+            break;
+        default:
+            break;
+        }
+    }
+}
+//  Auto Added by "SMeshLink SMeshStudio"
+
diff -r 000000000000 -r 66026ba8292a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Apr 06 11:28:05 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file