Example: Chat

Now that you know how to build a Basic chat between two XBee modules in transparent mode, let's go one step further. As you learned, an XBee module in transparent mode simply passes information along exactly as it receives it. API mode allows for more flexibility and, in many cases, increased reliability.

In API mode, you still send the message to the module. But, you also send other necessary information, such as the destination address or checksum value, all wrapped in a packet with a defined structure called an API frame. This means that in API mode you don't need to set the destination address (DH + DL) in the module. Similarly, the receiver module receives more information than the message itself, such as the source address, signal strength, or checksum value.

Tip Detailed information about API operation can be found in the legacy XBee/XBee-PRO 802.15.4 RF Module User Guide and the XBee/XBee-PRO S2C 802.15.4 RF Module User Guide.

In this example you will repeat the previous chat but in API mode. To that end, you will create an application in Java programming language. To simplify that application, you will use the XBee Java Library, an easy-to-use API that allows you to interact with the XBee modules.

Note Several steps contain videos to help you successfully complete the example. If you get stuck, go to Troubleshooting.