APP3 / Zigbee_communication

Dependents:   Coordinator_node Router_node

Revision:
11:7b5b9c1ab757
Parent:
10:dac25a0076f5
Child:
12:e62381cdc9de
Child:
16:13ab66e244c3
--- a/xbee.cpp	Tue Feb 14 20:23:39 2017 +0000
+++ b/xbee.cpp	Tue Feb 14 21:00:47 2017 +0000
@@ -323,10 +323,15 @@
     char checksum;
     char data = 0;
     char total = 0x90;
-        
+    
+    printHexa(len+1); // DEBUG PRINT
+    pcPrint(" On recoit :"); // DEBUG PRINT
+    
     while(i < 8)
     {
         adresse64bit[i] = getChar();
+        pcPrint(" "); // DEBUG PRINT
+        printHexa(adresse64bit[i]); // DEBUG PRINT
         total += adresse64bit[i];
         i++;
     }
@@ -337,25 +342,38 @@
     total += adresse16bit[0];
     total += adresse16bit[1];
     
+    pcPrint(" "); // DEBUG PRINT
+    printHexa(adresse16bit[0]); // DEBUG PRINT
+    pcPrint(" "); // DEBUG PRINT
+    printHexa(adresse16bit[1]); // DEBUG PRINT
+    
     receiveOptions = getChar();
+    pcPrint(" "); // DEBUG PRINT
+    printHexa(receiveOptions); // DEBUG PRINT
+    
     total += receiveOptions;
     
-    printHexa(len - 11);
-    pcPrint(" Data received : ");
+    //printHexa(len - 11);
+    //pcPrint(" Data received : ");
     
     i = 11;
     while (i < len)
     {
         data = getChar();
         total += data;
-        printHexa(data);
+        pcPrint(" "); // DEBUG PRINT
+        printHexa(data); // DEBUG PRINT
         i++;   
     }
-    pcPrint("\r\n");
     
     checksum = getChar();
     total += checksum;
     
+    pcPrint(" "); // DEBUG PRINT
+    printHexa(checksum); // DEBUG PRINT
+    
+    pcPrint("\r\n");
+    
     if (total != 0xFF)
     {
         pcPrint("Checksum is wrong\0");
@@ -423,11 +441,15 @@
     
     // Envoyer la commande sur UART
     i = 0;
+    pcPrint("On envoie :"); // DEBUG PRINT
     while (i < cmdlength)
     {
-        comm.putc(cmdtosend[i]);
+        comm.putc(cmdtosend[i]); // DEBUG PRINT
+        pcPrint(" ");
+        printHexa(cmdtosend[i]); // DEBUG PRINT
         i++;
     }
+    pcPrint("\r\n"); // DEBUG PRINT
     wait(0.1);
 }