Hello guys, some time ago I did a post about of changing the power level of the xbee. Now I want to prove that changing.
I'm using one xbee series 1 connected to one xbee shield and one arduino duemilanove.
And I use one Xbee USB Xplorer to do readings on the X-CTU.
I'm using the following code to change the power level of the xbee:
void setup ()
{
Serial.begin(9600);
Serial.print("X");
delay(1100);
Serial.print("+++");
delay(1100);
if (returnedOK() == 'T') {
}
else {
setup();
}
while(returnedOK() != 'T'){
Serial.println("ATPL 3");
delay (1000);
}
Serial.println("ATPL");
delay(1000);
Serial.println("CN");
}
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;
}
As can be seen by the code I'm using the function returnedOK to test if the byte was received and continue the changes.
But after all the steps have been completed, I disconnect the xbee from the shield and I connect the xbee to the USB xplorer and I look in the X-CTU to see the power level change. But that isn't changed (continues 4 - standard).
I want to know why it isn't changing since I'm receiving the confirmation byte.
Thanks