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

Dependencies:   mbed MultiSerial

Revision:
10:5b67d18f30a9
Parent:
9:f05f881226a3
Child:
11:8b1a63a1172a
--- a/main.cpp	Thu Sep 04 02:39:04 2014 +0000
+++ b/main.cpp	Thu Sep 04 02:53:40 2014 +0000
@@ -26,7 +26,7 @@
 
 MultiSerial xbee(p13,p14,read);
 
-//MultiSerial armMbed(p9,p10,write);
+MultiSerial armMbed(p9,p10,write);
 
 typedef struct{
 
@@ -37,13 +37,13 @@
 
 xbee_packet packet;
 
-uint8_t get_data[DATA_NUM];
+uint8_t get_data[DATA_NUM]={0};
 
 int main()
 {
     //sw.mode(PullUp);
     
-  //  xbee_packet *pt_packet=&packet;
+    xbee_packet *pt_packet=&packet;
     
     xbee.read_data(get_data,XBEE_KEY);        
     
@@ -58,8 +58,8 @@
               
         //memcpy(&packet, get_data, DATA_NUM); //ちょい危険
 
-        packet.arm[0] = get_data[0];
-        packet.leg = get_data[1];   
+        packet.arm[0] = get_data[1];
+        packet.leg = get_data[0];   
         
         check = get_data[1];
 
@@ -69,9 +69,9 @@
         if(packet.leg&0x4) motors = 0x50; //p25,p27        
         if(packet.leg&0x8) motors = 0xA0; //p26,p28
         
-        pc.printf(" arm = %d" ,packet.arm[1]);
+        pc.printf(" arm = %d" ,packet.arm[0]);
         pc.printf(" leg = %d" ,packet.leg);
         
-       // armMbed.write_data(pt_packet->arm,ARM_KEY);                  
+        armMbed.write_data(pt_packet->arm,ARM_KEY);                  
     }
 }
\ No newline at end of file