Xbee Shield For Arduino (DFR0015)

Dear All,
I have a Xbee S2 Pro , arduino uno and Xbee shield (DFR0015)..i want to configured the xbee via arduino (not with X-CTU) so i write a fonction configureRadio() like this tuto :
https://www.inkling.com/read/arduino-dfrobot ... ecipe-14-3
when i upload the sketch ,i put the switches prog/usb
when is ok, i put the switches run/xbee
but doesn't work !!!
I have a Xbee S2 Pro , arduino uno and Xbee shield (DFR0015)..i want to configured the xbee via arduino (not with X-CTU) so i write a fonction configureRadio() like this tuto :
https://www.inkling.com/read/arduino-dfrobot ... ecipe-14-3
when i upload the sketch ,i put the switches prog/usb
when is ok, i put the switches run/xbee
but doesn't work !!!
2013-03-27 09:32:25
maro
Code: Select all
boolean configured;
int ledPin = 13; // LED connected to digital pin 13
boolean configureRadio() {
// put the radio in command mode:
Serial.print("+++");
String ok_response = "OK\r"; // the response we expect.
// Read the text of the response into the response variable
String response = String("");
while (response.length() < ok_response.length()) {
if (Serial.available() > 0) {
response += (char) Serial.read();
}
}
// If we got the right response, configure the radio and return true.
if (response.equals(ok_response)) {
Serial.print("ATID3137\r");
Serial.print("ATCN\r"); // back to data mode
return true;
} else {
return false; // This indicates the response was incorrect.
}
}
void setup () {
Serial.begin(9600); // Begin serial
configured = configureRadio();
}
void loop () {
if (configured) {
Serial.print("Hello!");
delay(3000);
}
else {
delay(30000); // Wait 30 seconds
configured = configureRadio(); // try again
}
}

2013-03-27 07:23:23 Have you try to remove the microcontroller, this is the reference for XBee Shield : http://arduino.cc/en/Main/ArduinoXbeeShield, hope this help you
czaroentoro

