![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test / example for the XBeeApi library
Example program employing the XBeeApi library to configure and communicate with an XBee. See the notebook page here
Diff: main.cpp
- Revision:
- 0:132f26d3350b
- Child:
- 1:3de4723efe9e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jan 18 19:44:28 2014 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" +#include "XBeeApi.hpp" +#include "XBeeDevice.hpp" +#include "XBeeApiCmdAt.hpp" + +Serial pc(USBTX, USBRX); // tx, rx + +XBeeDevice xbeeDevice( PTA2, PTA1, NC, NC ); // tx, rx + +XBeeApi xbeeApi(xbeeDevice); + + +uint8_t foo = 0; + +int main() { + XBeeApiCmdAt cmd; + XBeeDevice::XBeeDeviceReturn_t status; + + /* Get API mode 2 set up */ + status = xbeeDevice.setUpApi(); + + if( status != XBeeDevice::XBEEDEVICE_OK ) + { + pc.printf("\r\n[%4d]: XBeeStatus: %d\r\n",__LINE__,status); + } + else + { + /* If we got the API set up should be OK to send an API command */ + xbeeDevice.SendCmd( &cmd ); + } + + while( 1 ) { + wait(1); + xbeeDevice.dumpRxBuffer( &pc, true ); + } + pc.printf("\r\n[%4d]: Done\r\n",__LINE__); +} \ No newline at end of file