Pages: [1]   Go Down
Author Topic: Xbee Shield For Arduino (DFR0015)  (Read 498 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear all,

I have a Xbee S2 Pro , arduino uno and Xbee shield (DFR0015)..i want to configured this xbee via arduino (not with X-CTU) so i write a fonction configureRadio() like this tuto :

https://www.inkling.com/read/arduino-cookbook-michael-margolis-2nd/chapter-14/recipe-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 !!!


* AT_XBee.jpg (42.01 KB, 831x442 - viewed 18 times.)
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49343
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The code you didn't post does something. You didn't explain what it does.
You want the code you didn't post to do something. You didn't explain what you want it to do.

Quote
when is ok, i put the switches run/xbee
When what is OK?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i want to configured the xbee ...
when i upload the sketch ,i put the switches prog/usb
when is the upload finish, i put the switches run/xbee
www.dfrobot.com/wiki/index.php/Xbee_Shield_For_Arduino_(no_Xbee)_(SKU:DFR0015)

but the xbee is not configured like say the tuto
Code:


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
  }
}

« Last Edit: March 26, 2013, 12:32:05 pm by maro » Logged

Pages: [1]   Go Up
Jump to: