Xbee star network communication


hello,
i using arduino uno , xbees of series 2. has different scenarios. project requirements below.

(1) working on project creating star network of xbees. in network, xbee at  base station should broadcast text message xbees connected it. now, should write text message in arduino serial monitor. , 1 finish message , press send, should broadcast message zigbees @ receiver end , show on serial monitor of arduino.
(2) xbees @ receiver end should reply text message base station.  again should type message in arduino serial monitor @ receiver end.

i have been trying on code broadcast text message, can send predefined text message. message displayed @ x ctu serial monitor. please check code below.

#include <xbee.h>


xbee xbee = xbee();

void setup()
{
 serial.begin(9600);
 serial.flush();
 
}



void loop()
{
 
 // create array holding data want send.
 uint8_t payload[] = { "thank you, come again!!!" };
 
 // specify address of remote xbee (this sh + sl)
  xbeeaddress64 addr64 = xbeeaddress64(0x00000000, 0x0000ffff); //broadcast
 //xbeeaddress64 addr64 = xbeeaddress64(0x0013a200, 0x40712631);
 
 // create tx request
 zbtxrequest zbtx = zbtxrequest(addr64, payload, sizeof(payload));
 
 // send request
 xbee.send(zbtx);
 delay(100);
}

now, if want send text message, whatever type in arduino serial monitor instead of sending uint8_t payload[] = { "thank you, come again!!!" };, can do?

please if can me code. want transmitter , receiver code in api mode.
please guys me. urgent.



Arduino Forum > Using Arduino > Project Guidance > Xbee star network communication


arduino

Comments