Yeongsoo Kim / Mbed 2 deprecated Test_Serial

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
yeongsookim
Date:
Sun Oct 06 12:47:29 2019 +0000
Commit message:
Test serial

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	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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Oct 06 12:47:29 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file