John Bailey
/
XBeeApiReceiveCallbackExample
Example of using the XBeeApi library to receive a message via a callback method
Revision 1:d8492e31f655, committed 2014-07-08
- Comitter:
- johnb
- Date:
- Tue Jul 08 20:24:04 2014 +0000
- Parent:
- 0:2c02b2e821f2
- Commit message:
- Set the XBee's 16-bit address
Changed in this revision
XBeeApi.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 |
diff -r 2c02b2e821f2 -r d8492e31f655 XBeeApi.lib --- a/XBeeApi.lib Sun Jul 06 21:47:58 2014 +0000 +++ b/XBeeApi.lib Tue Jul 08 20:24:04 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/johnb/code/XBeeApi/#dde04adb8791 +http://mbed.org/users/johnb/code/XBeeApi/#37bba77ee73f
diff -r 2c02b2e821f2 -r d8492e31f655 main.cpp --- 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 ) ) {