Hello world example for xbee_lib

Dependencies:   mbed xbee_lib

Committer:
tristanjph
Date:
Fri Aug 31 14:45:07 2012 +0000
Revision:
1:b2b2ed674cbf
Parent:
0:c61faf93bc2a
Documentation update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tristanjph 0:c61faf93bc2a 1 #include "mbed.h"
tristanjph 0:c61faf93bc2a 2 #include "xbee.h"
tristanjph 0:c61faf93bc2a 3
tristanjph 0:c61faf93bc2a 4 xbee xbee1(p9,p10,p11); //Initalise xbee_lib
tristanjph 0:c61faf93bc2a 5
tristanjph 0:c61faf93bc2a 6 int main()
tristanjph 0:c61faf93bc2a 7 {
tristanjph 0:c61faf93bc2a 8 int device_serial[8];
tristanjph 0:c61faf93bc2a 9 int security_key[8];
tristanjph 0:c61faf93bc2a 10 int Pan_ID;
tristanjph 1:b2b2ed674cbf 11 char send_data[202]; //The buffer inside the Xbee can only store 202 bytes
tristanjph 1:b2b2ed674cbf 12 char read_data[202]; //The buffer inside the Xbee can only store 202 bytes
tristanjph 0:c61faf93bc2a 13
tristanjph 0:c61faf93bc2a 14 xbee1.ConfigMode(); //Enter the xbee's config mode
tristanjph 0:c61faf93bc2a 15 xbee1.GetSerial(device_serial); //Read the xbee devices serial into device_serial
tristanjph 0:c61faf93bc2a 16 xbee1.SetKey(security_key); //Set the network key to security_key
tristanjph 0:c61faf93bc2a 17 xbee1.SetPanId(Pan_ID); // set the PAN network id to Pan_ID
tristanjph 0:c61faf93bc2a 18 xbee1.WriteSettings(); // Write the settings to non volatile memory
tristanjph 0:c61faf93bc2a 19 xbee1.ExitConfigMode(); //Exit config mode
tristanjph 0:c61faf93bc2a 20 xbee1.reset(); //Reset Xbee
tristanjph 0:c61faf93bc2a 21
tristanjph 0:c61faf93bc2a 22 xbee1.SendData(send_data); //Send the data in send_data
tristanjph 0:c61faf93bc2a 23 xbee1.RevieveData(read_data); //Put recieved data into read_data
tristanjph 0:c61faf93bc2a 24
tristanjph 0:c61faf93bc2a 25
tristanjph 0:c61faf93bc2a 26 }