Don't receiving confirmation of the changes from the xbee


   hello guys, time ago did post of changing power level of xbee. want prove changing.
   i'm using 1 xbee series 1 connected 1 xbee shield , 1 arduino duemilanove.
   and use 1 xbee usb xplorer readings on x-ctu.

   i'm using following code change power level of xbee:

code: [select]

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) {
   
      (int i=0; i<3; i++) {
        incomingchar[i] = serial.read();
      }
      if ( strstr(incomingchar, okstring) != null ) {

        result = 't';
      } 
      else {
        result = 'f';
      }
    }
  }
  return result;
}


   as can seen code i'm using function returnedok test if byte received , continue changes.
   but after steps have been completed, disconnect xbee shield , connect xbee usb xplorer , in x-ctu see power level change. isn't changed (continues 4 - standard).
    want know why isn't changing since i'm receiving confirmation byte.
thanks

code: [select]
    if (serial.available() > 1) {
   
      (int i=0; i<3; i++) {
        incomingchar[i] = serial.read();
      }

if there 2 bytes, read 3 of them. hmmm... fail!

code: [select]
      if ( strstr(incomingchar, okstring) != null ) {
you can't pass non-string string function. fail!

a string null terminated array of chars. have array of chars, not string.


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Don't receiving confirmation of the changes from the xbee


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial