Test / example for the XBeeApi library

Dependencies:   XBeeApi mbed

Example program employing the XBeeApi library to configure and communicate with an XBee. See the notebook page here

main.cpp

Committer:
johnb
Date:
2014-01-18
Revision:
0:132f26d3350b
Child:
1:3de4723efe9e

File content as of revision 0:132f26d3350b:

#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__);
}