Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jderemer3
Date:
Wed Mar 01 16:37:51 2017 +0000
Commit message:

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	Wed Mar 01 16:37:51 2017 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+ 
+BusOut myled(LED1,LED2,LED3,LED4);
+Serial bluemod(p28,p27);
+PwmOut red(p21);
+PwmOut green(p22);
+PwmOut blue(p23);
+ 
+int main()
+{
+    char bred=0;
+    char bgreen=0;
+    char bblue=0;
+    red = green = blue = 0;
+    while(1) {
+        if (bluemod.getc()=='!') {
+            if (bluemod.getc()=='C') { //color data packet
+                bred = bluemod.getc(); // RGB color values
+                bgreen = bluemod.getc();
+                bblue = bluemod.getc();
+                if (bluemod.getc()==char(~('!' + 'C' + bred + bgreen + bblue))) { //checksum OK?
+                    red = bred/255.0; //send new color to RGB LED PWM outputs
+                    green = bgreen/255.0;
+                    blue = bblue/255.0;
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Mar 01 16:37:51 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f
\ No newline at end of file