Demo of LED lighting effects using PWM and wait for time delays. Pins are setup for LPC1768 platform’s LEDs. For complete information, see http://developer.mbed.org/users/4180_1/notebook/led-lighting-effects-for-modelers/

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
4180_1
Date:
Fri Nov 28 17:55:51 2014 +0000
Commit message:
ver 1.0

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	Fri Nov 28 17:55:51 2014 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+//LED Warning Beacon Lighting Effect
+PwmOut myled(LED2);
+//Use a PWM output to enable dimming
+//1.0 is full on, 0.0 off, 0.5 50% on
+int main()
+{
+    while(1) {
+        //LED warm up effect using PWM
+        for(int i=0; i<50; i++) {
+            myled = i/50.0;
+            wait(0.02);
+        }
+        //LED at full brightness level
+        myled = 1.0;
+        wait(0.25);
+        //LED cool down effect using PWM
+        for(int i=49; i>0; i--) {
+            myled = i/50.0;
+            wait(0.02);
+        }
+        //LED off
+        myled = 0.0;
+        wait(1.5);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Nov 28 17:55:51 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file