中継機能つけた受け取りオムニ

Dependencies:   mbed MultiSerial

Revision:
11:8b1a63a1172a
Parent:
10:5b67d18f30a9
Child:
12:6e2ee1c83ac1
diff -r 5b67d18f30a9 -r 8b1a63a1172a main.cpp
--- a/main.cpp	Thu Sep 04 02:53:40 2014 +0000
+++ b/main.cpp	Thu Sep 04 04:51:51 2014 +0000
@@ -46,12 +46,10 @@
     xbee_packet *pt_packet=&packet;
     
     xbee.read_data(get_data,XBEE_KEY);        
-    
+    int i=0;
     for(;;){
         
-        wait(0.1);
- 
-        check = !check;  
+        wait_ms(0.1);
         
        // get_data[0]=0xFF;
        // get_data[1]=0x01;    
@@ -69,9 +67,13 @@
         if(packet.leg&0x4) motors = 0x50; //p25,p27        
         if(packet.leg&0x8) motors = 0xA0; //p26,p28
         
-        pc.printf(" arm = %d" ,packet.arm[0]);
-        pc.printf(" leg = %d" ,packet.leg);
+        if(i==10e3){ 
+            pc.printf(" arm = %d" ,packet.arm[0]);
+            pc.printf(" leg = %d" ,packet.leg);
+            i=0;
+        }
         
         armMbed.write_data(pt_packet->arm,ARM_KEY);                  
+        i++;
     }
 }
\ No newline at end of file