シリアル通信のテスト用

Dependencies:   mbed

Revision:
0:0eb43c144d1b
diff -r 000000000000 -r 0eb43c144d1b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 14 15:38:51 2016 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+ 
+Serial pc(USBTX, USBRX); // tx, rx
+Serial serialPin(dp16,dp15);
+
+int main() {
+    pc.baud(9600);
+    serialPin.baud(9600);
+    pc.printf("Hello World!");
+    int num;
+    while(1) {
+        num=serialPin.getc();
+        pc.putc(num);
+        if(num==1){
+            pc.printf("get1");
+    }
+    if(num==0){
+        pc.printf("get0");
+        }
+        }
+}
\ No newline at end of file