Code APP3

Dependencies:   mbed EthernetInterface WebSocketClient mbed-rtos BufferedSerial

Fork of APP3_Lab by Jean-Philippe Fournier

Revision:
2:a9bb12eefc08
Parent:
1:ea1b52d0a8a3
Child:
5:9e6a09a38785
--- a/main.cpp	Wed Sep 27 19:58:38 2017 +0000
+++ b/main.cpp	Sat Sep 30 18:02:41 2017 +0000
@@ -1,22 +1,29 @@
 #include "mbed.h"
-    
+
 #include "xbee.h"
-    
+
+#define IS_COORDINATOR 0
+
 #define PAN_ID 0xC0FFEE
-    
-    
+
 Serial pc(USBTX, USBRX); // tx, rx
 
 int main() {
-    
+
     xbee_init();
-    
+
     char c;
-    
+
     char hello_world[12] = "Hello world";
-    
-    transmit_request(hello_world, 11);
-    
+
+#if IS_COORDINATOR
+
+#else
+    DECLARE_ADDR64_COORD
+    DECLARE_ADDR16_UNKNOWN_OR_BCAST
+    transmit_request(hello_world, 11, 0, USE_ADDR64_COORD, USE_ADDR16_UNKNOWN_OR_BCAST);
+#endif
+
     while(1) {
         if (pc.readable())
         {