Hello World For FRDM-KL25Z

Files at this revision

API Documentation at this revision

Comitter:
mshaffe4
Date:
Thu Apr 25 00:26:07 2013 +0000
Commit message:
This is just a HelloWorld Program that make the rainbow lights go

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 4364328db887 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 25 00:26:07 2013 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+
+ 
+PwmOut r (LED_RED);
+PwmOut g (LED_GREEN);
+PwmOut b (LED_BLUE);
+ 
+int main() {
+    r.period(0.001);
+    g.period(0.001);
+    b.period(0.001);
+ 
+    while (true) {
+        for (float i = 0.0; i < 1.0 ; i += 0.001) {
+            float p = 3 * i;
+            r = 1.0 - ((p < 1.0) ? 1.0 - p : (p > 2.0) ? p - 2.0 : 0.0);
+            g = 1.0 - ((p < 1.0) ? p : (p > 2.0) ? 0.0 : 2.0 - p);
+            b = 1.0 - ((p < 1.0) ? 0.0 : (p > 2.0) ? 3.0 - p : p - 1.0);
+            wait (0.0025);
+        }
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 4364328db887 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 25 00:26:07 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7e6c9f46b3bd
\ No newline at end of file