Go Down

Topic: XBee Shield prevents setting parameters (Read 288 times) previous topic - next topic

Benj

Hi,

I have been building a wireless system using Arduino Diecimila and MaxStream XBee components. Thus far, I've just been using the bare XBee chip (with a SparkFun breakout board). I just purchased an XBee Shield for another Diecimila board, hoping to reduce some of my wire clutter. However, after much debugging to figure out why my formerly functional program no longer worked with the shield in place of the plain XBee chip, I figured out that this portion of the program (from http://www.makingthingstalk.com/chapter6/30/#more-30) is hanging up with the XBee shield:

void setDestination() {
 // put the radio in command mode:
 Serial.print("+++");
 // wait for the radio to respond with "OK\r"
 char thisByte = 0;
 while (thisByte != '\r') {
   if (Serial.available() > 0) {
     thisByte = Serial.read();
   }
 }

 // set the destination address, using 16-bit addressing.
 // if you're using two radios, one radio's destination
 // should be the other radio's MY address, and vice versa:
 Serial.print("ATDH0, DL5678\r");
 // set my address using 16-bit addressing:
 Serial.print("ATMY1234\r");
 // set the PAN ID. If you're working in a place where many people
 // are using XBees, you should set your own PAN ID distinct
 // from other projects.
 Serial.print("ATID1111\r");
 // put the radio in data mode:
 Serial.print("ATCN\r");
}

I managed to get it working by commenting out the call to SetDestination(), basically skipping all of that code, and using the Arduino/XBee shield with the jumpers in the USB position to set the address, etc of the XBee directly through a serial terminal, save with the WR command, then download the modified program and run. All is well now -- meaning that the XBee communicates normally with the Arduino, as well as with the rest of the network, now that I've set the parameters -- but I find this workaround very frustrating. Why did the XBee Shielf installation break that formerly functioning piece of code? Any ideas? Any suggestions of how to get that functionality (setting XBee parameters with the Arduino) back into the program?

Thanks!

Benj

Go Up