example

Dependencies:   xbee_lib

Fork of Xbee_Hello_world_A by SONG BONG SOO

Committer:
mdo131
Date:
Fri Nov 03 00:06:52 2017 +0000
Revision:
1:114432971517
Parent:
0:9cbddcc86466
Child:
2:c28639345230
example;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tristanjph 0:9cbddcc86466 1 #include "mbed.h"
tristanjph 0:9cbddcc86466 2 #include "xbee.h"
tristanjph 0:9cbddcc86466 3
tristanjph 0:9cbddcc86466 4 xbee xbee1(p9,p10,p11); //Initalise xbee_lib
tristanjph 0:9cbddcc86466 5 Serial pc(USBTX, USBRX); //Initalise PC serial comms
tristanjph 0:9cbddcc86466 6
tristanjph 0:9cbddcc86466 7 int main()
tristanjph 0:9cbddcc86466 8 {
tristanjph 0:9cbddcc86466 9 char send_data[202]; //Xbee buffer size is 202 bytes
tristanjph 0:9cbddcc86466 10 char read_data[202]; //Xbee buffer size is 202 bytes
tristanjph 0:9cbddcc86466 11
tristanjph 0:9cbddcc86466 12 while(1) {
tristanjph 0:9cbddcc86466 13 pc.scanf("%s",send_data); //Read data from serial console
tristanjph 0:9cbddcc86466 14 xbee1.SendData(send_data); //Send data to XBee
tristanjph 0:9cbddcc86466 15 xbee1.RecieveData(read_data,0); //Read data from the XBee
tristanjph 0:9cbddcc86466 16 pc.printf("You said:%s",read_data);
tristanjph 0:9cbddcc86466 17 }
tristanjph 0:9cbddcc86466 18 }
mdo131 1:114432971517 19
mdo131 1:114432971517 20 //about xbee pro
mdo131 1:114432971517 21 //https://os.mbed.com/components/Xbee-Pro/