XBee ZigBee communicator receives reports from other XBee modules from the Personal Network and writes it to the PC though the default Serial channel.

Dependencies:   mbed BufferedSerial

Files at this revision

API Documentation at this revision

Comitter:
cspista
Date:
Thu Dec 16 12:42:47 2021 +0000
Commit message:
Final version

Changed in this revision

BufferedSerial.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BufferedSerial.lib	Thu Dec 16 12:42:47 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/cspista/code/BufferedSerial/#ea5ad8e00c99
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 16 12:42:47 2021 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+#include "BufferedSerial.h"
+
+BufferedSerial pc(USBTX,USBRX);
+BufferedSerial xbee(PA_0, PA_1);
+
+char fb[1024];
+
+int main()
+{
+    pc.baud(115200);
+    xbee.baud(38400);
+    int i = 0;
+    pc.printf("\r\nXbee COORDINATOR1 received:\r\n");
+    while(1) {
+        while(xbee.readable()) {
+            fb[i++] = xbee.getc();
+        }
+        if(i<20) {
+            wait(0.5);
+        } else {
+            for(int c=0; c<i; c++) {
+                pc.printf("%02x ",fb[c]);
+            }
+            pc.printf("\r\n");
+            i = 0;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Dec 16 12:42:47 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file