Tristan Hughes
/
Xbee_Hello_world
Hello world example for xbee_lib
Diff: main.cpp
- Revision:
- 0:c61faf93bc2a
- Child:
- 1:b2b2ed674cbf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 29 14:32:10 2012 +0000 @@ -0,0 +1,26 @@ +#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]; + char read_data[202]; + + 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 + + +}