Tristan Hughes / Mbed 2 deprecated Xbee_Hello_world

Dependencies:   mbed xbee_lib

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "xbee.h"
00003 
00004 xbee xbee1(p9,p10,p11); //Initalise xbee_lib
00005 
00006 int main()
00007 {
00008     int device_serial[8];
00009     int security_key[8];
00010     int Pan_ID;
00011     char send_data[202]; //The buffer inside the Xbee can only store 202 bytes 
00012     char read_data[202]; //The buffer inside the Xbee can only store 202 bytes 
00013 
00014     xbee1.ConfigMode(); //Enter the xbee's config mode
00015     xbee1.GetSerial(device_serial); //Read the xbee devices serial into device_serial
00016     xbee1.SetKey(security_key); //Set the network key to security_key
00017     xbee1.SetPanId(Pan_ID); // set the PAN network id to Pan_ID
00018     xbee1.WriteSettings(); // Write the settings to non volatile memory
00019     xbee1.ExitConfigMode(); //Exit config mode
00020     xbee1.reset(); //Reset Xbee
00021 
00022     xbee1.SendData(send_data); //Send the data in send_data
00023     xbee1.RevieveData(read_data); //Put recieved data into read_data
00024 
00025 
00026 }