Hello world example for xbee_lib

Dependencies:   mbed xbee_lib

main.cpp

Committer:
tristanjph
Date:
2012-08-31
Revision:
1:b2b2ed674cbf
Parent:
0:c61faf93bc2a

File content as of revision 1:b2b2ed674cbf:

#include "mbed.h"
#include "xbee.h"

xbee xbee1(p9,p10,p11); //Initalise xbee_lib

int main()
{
    int device_serial[8];
    int security_key[8];
    int Pan_ID;
    char send_data[202]; //The buffer inside the Xbee can only store 202 bytes 
    char read_data[202]; //The buffer inside the Xbee can only store 202 bytes 

    xbee1.ConfigMode(); //Enter the xbee's config mode
    xbee1.GetSerial(device_serial); //Read the xbee devices serial into device_serial
    xbee1.SetKey(security_key); //Set the network key to security_key
    xbee1.SetPanId(Pan_ID); // set the PAN network id to Pan_ID
    xbee1.WriteSettings(); // Write the settings to non volatile memory
    xbee1.ExitConfigMode(); //Exit config mode
    xbee1.reset(); //Reset Xbee

    xbee1.SendData(send_data); //Send the data in send_data
    xbee1.RevieveData(read_data); //Put recieved data into read_data


}