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
main.cpp
- Committer:
- cspista
- Date:
- 2021-12-16
- Revision:
- 0:b130d24d6fa3
File content as of revision 0:b130d24d6fa3:
#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; } } }