Simple example of how to use XBeeApi - set up the XBee, configure P2P networking then transmit a frame.
Dependents: XBeeApiBroadcastExample
See also the the API page
Diff: main.cpp
- Revision:
- 4:d6c480d80f84
- Parent:
- 3:8fea787c2199
diff -r 8fea787c2199 -r d6c480d80f84 main.cpp --- a/main.cpp Fri Mar 28 22:31:04 2014 +0000 +++ b/main.cpp Sun Jul 06 21:01:14 2014 +0000 @@ -58,7 +58,7 @@ XBeeDevice::XBeeDeviceReturn_t status; /* This is the frame we're going to transmit */ - XBeeApiTxFrame frame( &xbeeDevice ); + XBeeApiTxFrame frame( &xbeeDevice, tx_data, sizeof( tx_data ), frameDestinationAddress ); /* Get API mode 2 set up - this is a pre-requisit to using other XBeeApi functions. This step may not be needed in the case that the XBee has already been configured @@ -72,10 +72,6 @@ /* Set up a peer-to-peer network using the specified PAN and channel */ xbeeSetNetworkTypeP2P( &atIf, myPANId, myChannelId ); - /* Set the data pointer & destination address in the transmit frame */ - frame.setDataPtr( tx_data, sizeof( tx_data ) ); - frame.setDestAddr( frameDestinationAddress ); - xbeeDevice.SendFrame( &frame ); } } \ No newline at end of file