ZigBee Receive Data example for mbed XBeeLib By Digi
You are viewing an older revision! See the latest version
Homepage
Description¶
This example shows how to receive data. A remote XBee module has sent a packet to our local XBee module though the air. The local XBee module receives the packet and sends it to the mbed cpu through the serial port. This library decodes the packet and calls a user defined method to process the packet.
Setup¶
Hardware¶
Local Setup¶
The local setup includes:
- The mbed module and its debug connection to the PC (normally an usb cable)
So you can see the sample application debug messages. For that you have to configure the DEBUG_TX and DEBUG_RX pins in config.h.
See Configuring the library and Debugging the library chapters for more info. - The connection between the mbed module and the local XBee module
That includes at least at least wiring and configuring RADIO_TX and RADIO_RX in config.h. Wiring RADIO_RESET is highly recommended as well.
See Configuring the library and Initializing modules chapters for more info. - The local XBee module persistent configuration
This library expects that the local XBee module has the default settings stored (but for the "AP" setting that must be set to 1 or 2). You can verify those settings previously to run the example using XCTU tool through following two options:
- Having the local radio wired to the mbed module, you can discover the local XBee module from a remote XBee module in the same network.
- You can temporarily unplug the local XBee module from the mbed module and plug it to the PC. Special care must be taken with following settings:
- "ID" setting: Leave it default or customize it as in your remote XBee module. The important thing is that both local and remote XBee modules create a network. This library has methods to change this setting but the sample applications are not calling them.
- Firmware: In S2B modules, end-device firmware will complicate evaluation of standard examples because the radio will sleep automatically. For that is recommended to flash 'router' firmware.
- "SM" setting: Set it to 0=No Sleep.
- "BD" setting: The sample applications expect it set to 3=9600bps. If you change it, change it in the sample application accordingly (See Initializing modules chapters for more info).
- "AP" setting: It's compulsory to change this setting set to 1 or 2 !!!!.