andrewrapp / xbee-arduino

Arduino library for communicating with XBee radios in API mode
GNU General Public License v2.0
334 stars 162 forks source link

Ack packet from receiver #65

Open victors0991 opened 6 years ago

victors0991 commented 6 years ago

I have two xbee s2b one coordinator and one router. I want to know if there is a way that receiver send ack when receiver recieve data from transmitter. ?

JChristensen commented 6 years ago

Yes, actually it's automatic. After sending data via a ZigBee Transmit Request frame (see ZBTxRequest) the transmitter will receive a ZigBee Transmit Status response frame (see ZBTxStatusResponse), which includes among other things, Delivery Status. Spend some time with the XBee User Guide and with the documentation for this library. It's all there but be patient there may be a bit of a learning curve if you're new to this sort of thing. Page 126 in the XBee User Guide explains the Transmit Status frame.

victors0991 commented 6 years ago

Yes I tried and its work. I have a last question. I have a problem now because xbee is booting faster that arduino so when xbee transmiter send data to xbee receiver, so xbee receiver replay with ack but that data never go to arduino because it is booting so I put power of xbee into digital pin in arduino so when arduino is booted so send power to that pin and xbee power and but that is not work because xbee is power but with a little voltaje becausd xbee's leds are power up but not brigther than when I send voltaje to xbee so how do can I do in order to power up xbee when arduino is booted. My xbee is in router mode

JChristensen commented 6 years ago

If only a small amount of data is being sent, the XBee should hold it in a buffer until the Arduino reads it.

It's a bad idea trying to power the XBee from an Arduino pin, it is not capable of supplying sufficient current to properly power the XBee. This could potentially damage the microcontroller. Also beware if the Arduino operates on 5V because the XBee is a 3.3V device and too much voltage will damage it.

I might use the XBee's reset pin. Hold it in reset until the Arduino is ready to talk to it. If the Arduino operates at 5V, a small level-shifting circuit will be needed to connect to the XBee reset pin.

victors0991 commented 6 years ago

My xbee have a shiled that take care about how many voltage it recieved for that reason I connect directly to arduino but when arduino power up, xbee power up but leds are less brigther than when I power up xbee using usb

JChristensen commented 6 years ago

Right. The LEDs are not as bright because the Arduino pin cannot supply sufficient current. Hope your microcontroller is OK.

victors0991 commented 6 years ago

Yes, me too. But if I use reset pin of xbee, I will erase all configuration and that I dont want to use. Is there any way to make xbee wait until arduino is booted?

JChristensen commented 6 years ago

As long as configuration changes have been written to non-volatile memory, a reset will not erase them.

victors0991 commented 6 years ago

I will try. I read the xbee-arduino library but what means xbeecallback function? If it uses when we want something to return?

victors0991 commented 6 years ago

And what happen when retry values on xbee is reached? If i write 2 retries, what happen next?