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:58:39 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:58:39 2014 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+//LED emergency vehicle lighting effect
+PwmOut myled(LED1);
+PwmOut myled2(LED4);
+//Use PWM for dimming
+
+int main()
+{
+    while(1) {
+        //flash three times on LED1
+        for(int i=0; i<3; i++) {
+            //ramp up brightness level
+            for(double x = 0.0; x <= 1.0; x = x+0.2) {
+                myled = x*x;
+                wait(.02);
+            }
+        }
+        myled=0.0; //LED1 off
+        //flash three times on LED2
+        for(int i=0; i<3; i++) {
+            //ramp up brightness level
+            for(double x = 0.0; x <= 1.0; x = x+0.2) {
+                myled2 = x*x;
+                wait(.02);
+            }
+        }
+        myled2=0.0; //LED2 off
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Nov 28 17:58:39 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file