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 18:01:50 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
diff -r 000000000000 -r c1e6182f8ed6 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Nov 28 18:01:50 2014 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+//LED Tower Strobe Light Effect
+//
+BusOut myleds(LED1, LED2, LED3, LED4);
+//groups 4 built-in LEDs digital outputs together
+//on mbed LPC1768 - change pins for other platforms
+int main()
+{
+    while(1) {
+        int j=1; //one LED on at start of loop
+        for(int i=1; i<16; i++) {
+            //sends out digital values for all LEDs (0 or 1)
+            myleds = j;
+            //binary shift the 1-bit (1=LED on) left by one
+            j = j<<1;
+            //use wait to add a time delay close to a real tower light
+            wait(0.093);
+        }
+    }
+}
+
diff -r 000000000000 -r c1e6182f8ed6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Nov 28 18:01:50 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file