回転数計のデータをトワイライトから受け取って回転数を計算して表示します。

Dependencies:   mbed

Fork of receive_twe by natsu tsumagari

Revision:
1:c1f5bd2b296c
Parent:
0:8876c8f2119f
Child:
2:f82d4b3f338f
diff -r 8876c8f2119f -r c1f5bd2b296c main.cpp
--- a/main.cpp	Sat Oct 22 04:09:40 2016 +0000
+++ b/main.cpp	Sat Oct 22 07:22:00 2016 +0000
@@ -2,13 +2,34 @@
 
 Serial pc(USBTX,USBRX);
 Serial twe(p13,p14);
+char val;
+int data_num;
 
 int main() {
     twe.baud(115200);
     pc.baud(115200);
+    data_num=0;
     while(1) {
         if(twe.readable()){
-            pc.putc(twe.getc());
+            val=twe.getc();
+            if(val==';'){
+                data_num++;
+//                pc.putc('\n');
+//                pc.putc('\r');
+                pc.putc((char)data_num);
+                pc.putc(':');
+            }
+            if(data_num==1)pc.putc(val);
+            if(data_num==6)pc.putc(val);
+            if(data_num==12)pc.putc(val);
+            if(data_num==13)pc.putc(val);
+            if(data_num==14)pc.putc(val);
+            if(data_num==15){
+                pc.putc('\n');
+                pc.putc('\r');
+                data_num=0;
+            }
+            
         }
     }
 }