Example of using the XBeeApi library to receive a message via a callback method

Dependencies:   XBeeApi mbed

Revision:
1:d8492e31f655
Parent:
0:2c02b2e821f2
--- a/main.cpp	Sun Jul 06 21:47:58 2014 +0000
+++ b/main.cpp	Tue Jul 08 20:24:04 2014 +0000
@@ -34,6 +34,9 @@
 #define XBEE_TX_PIN PTA2
 #define XBEE_RX_PIN PTA1
 
+/* Network address for our XBee */
+const uint16_t myNetworkAddress = 0x1234;
+
 /* ID for the Personal Area Network we're going to join */
 const XBeeApiCmdAt::panId_t myPANId = 1000;
 
@@ -82,6 +85,9 @@
 
     if( status == XBeeDevice::XBEEDEVICE_OK )
     {
+        /* Set the 16-bit source address of this XBee */
+        atIf.setSourceAddress( myNetworkAddress );
+
         /* Set up a peer-to-peer network using the specified PAN and channel */
         if( xbeeSetNetworkTypeP2P( &atIf, myPANId, myChannelId ) )
         {