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:14 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 4420127af442 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Nov 28 18:01:14 2014 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+//LED Lighthouse or Searchlight lighting effect
+PwmOut myled(LED1);
+//use Pwm output for dimming
+
+int main()
+{
+    float y=0.0;
+    while(1) {
+        for(double x=0.0; x <= 3.14159; x = x + 0.0314159) {
+            y = sin(x); //nice periodic function 0..1..0
+            myled = y*y*y;//exponential effect - needs a sharp peak
+            wait(.025);
+        }
+        myled = 0.0;
+        //most lighthouses have a 5 second delay - so add another 2.5
+        wait(2.5);
+    }
+}
diff -r 000000000000 -r 4420127af442 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Nov 28 18:01:14 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file