a

Revision:
0:e08f7610c886
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 19 06:59:11 2020 +0000
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2006-2020 Arm Limited and affiliates.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "mbed.h"
+
+static BufferedSerial pc(USBTX, USBRX); // tx, rx
+PwmOut led(LED1);
+
+float brightness = 0.0;
+
+int main()
+{
+    char msg[] = "Press 'u' to turn LED1 brightness up, 'd' to turn it down\n";
+    char *c = new char[1];
+    pc.write(msg, sizeof(msg));
+
+    while (1) {
+        pc.read(c, sizeof(c));
+        pc.write(c, sizeof(c));
+        if ((*c == 'u') && (brightness < 0.5)) {
+            brightness += 0.01;
+            led = brightness;
+        }
+        if ((*c == 'd') && (brightness > 0.0)) {
+            brightness -= 0.01;
+            led = brightness;
+        }
+    }
+
+}
\ No newline at end of file