Yeongsoo Kim / Mbed 2 deprecated Test_Serial

Dependencies:   mbed

Revision:
0:b607e9d67e56
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Oct 06 12:47:29 2019 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+PwmOut led1(LED1);
+PwmOut led2(LED2);
+PwmOut led3(LED3);
+PwmOut led4(LED4);
+
+int main()
+{
+    pc.printf("Press '1' On LED1\n");
+    pc.printf("Press '2' On LED2\n");
+    pc.printf("Press '3' On LED3\n");
+    pc.printf("Press '4' On LED4\n");
+    pc.printf("Press '0' Off All LED\n");
+       
+    while(1)
+    {
+        pc.printf("Waiting Request\n");
+        char c = pc.getc();
+        pc.printf("Complete Response\n");
+       
+        if(c == '1') led1 = 1;
+        if(c == '2') led2 = 1;
+        if(c == '3') led3 = 1;
+        if(c == '4') led4 = 1;
+        if(c == '0')
+        {
+            led1 = 0;
+            led2 = 0;
+            led3 = 0;
+            led4 = 0;
+        }
+    }
+}
\ No newline at end of file