Hello everyone.
Foreword my lack of knowledge in programming, I ask for help on a problem.
I have two arduino shield with Xbee S2 (an end device and a coordinator).
I'm trying to get them to communicate with each other and get the value of RSSI using the DB called via AT commands. The problem is that the total is 0 even when the devices are associated.
Both devices are in API mode.
I attach the sketch that I wrote
Thank you in advance for any help.
#include <XBee.h>
#include <string.h>
AtCommandRequest Request AtCommandRequest = ();
AtCommandResponse AtCommandResponse Response = ();
XBee XBee xbee = ();
uint8_t DB [] = {'D', 'B'};
int timeout = 1000;
void setup () {
xbee.begin (9600);
delay (500);
}
void loop () {
nodeCount int = 0;
Request.setCommand (DB);
Serial.print ("Sending command to the XBee");
xbee.send (request);
Serial.println ("");
while (xbee.readPacket (timeout)) {
if (xbee.getResponse (). getApiId () == AT_COMMAND_RESPONSE) {
xbee.getResponse (). getAtCommandResponse (Response);
}
}
Serial.print ("Results");
int i = 0;
while (i <Response.getValueLength ()) {
i ++;
}
Serial.print (Response.getValue (), HEX);
Serial.print ("");
Serial.println ("");
}