Faludi I tried to do one function to see if the xbee returns "OK" based on your code (char returnedOK () ).
But i'm still don't receiving the ok, and when I connect the xbee to the Xbee Xplorer USB to check in X-CTU if something have changed, I didn't see any change of the previously configuration.
The code is that:
void setup ()
{
Serial.begin(9600);
Serial.print("X");
delay(1100);
Serial.print("+++");
delay(1100);
if (returnedOK() == 'T') {
}
else {
setup();
}
Serial.println("ATPL3");
Serial.println("ATPL");
}
void loop ()
{
}
char returnedOK () {
char incomingChar[3];
char okString[] = "OK";
char result = 'n';
int startTime = millis();
while (millis() - startTime < 2000 && result == 'n') {
if (Serial.available() > 1) {
for (int i=0; i<3; i++) {
incomingChar[i] = Serial.read();
}
if ( strstr(incomingChar, okString) != NULL ) {
result = 'T';
}
else {
result = 'F';
}
}
}
return result;
}
I'm really in doubt now if the xbee connected to an xbee shield could change your configurations without I have to use a Xbee Xplorer USB.