Blue LDM test for CP4

Dependencies:   mbed

Revision:
0:c57b9d018b9f
Child:
1:5c0202cb8e6d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Dec 12 15:13:50 2018 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+PwmOut led1(p23);
+PwmOut led2(p24);
+PwmOut led3(p25);
+
+float brightness = 1.0;
+
+int main() {
+    pc.printf("Press 'u' to turn LED1 brightness up, 'd' to turn it down\n");
+
+    while(1) {
+        char c = pc.getc();
+        if((c == 'u') && (brightness < 1.0)) {
+            brightness += 0.01;
+            led1 = brightness;
+            led2 = brightness;
+            led3 = brightness;
+        }
+        if((c == 'd') && (brightness > 0.0)) {
+            brightness -= 0.01;
+            led1 = brightness;
+            led2 = brightness;
+            led3 = brightness; 
+        } 
+
+    }
+}
\ No newline at end of file