Hello, I have an xbee pro shield with an xbee series 1 and Arduino microprocessor. I found this documentation http://www.cooking-hacks.com/documentation/tutorials/arduino-xbee-shield but I find it not informative. What I want to do is to configure which device to send to which device (changing DL/DH and MY), but I don't know how. I tried to send commands to module via. Arduino serial monitor, but it does not work. After sending +++, any command I send after waiting a while does not get any response. This is even if I follow all directions.
More importantly, however, I want to configure the xbee on the fly, able for the Arduino to send commands while running. How do I send code to xbee? How do I read command output from xbee? Any sample code/ documentation/ tutorials really really appreciated.
You need to check all the baud rates (if u have brand new Xbee module it should comunicate on 9600). Use USB adaptor (sparkfun for example) and then try to connect over XCTU or over some terminal. If you want to access it over UNO and Serial, load there simple echo script. It would be echoing characters from Serial to some softserial pins where Xbee is connected. Will send it to u if needed.
If u need to send some command, you need to bring Xbee to command mode over escape characters (default it is +, CC register), u need to maintain GT timeout before and after '+++' (NO Enter char after +++). Then after 1s (default GT setting ) you will get 'OK' and u are in command mode.
Then you can send commands starting starting with AT and Enter char (for example in C you need to send "ATTP\r" - you will get temperature), when you set some parameter you need to send "ATGT100\r" then you will get "OK" if sucesfull.
If you want to save setting send ATWR and to exit from command mode send ATCN.
If it doesn't communicate, make sure there is not set sleep mode (you can test with LED, pin 13 if I remember). If still nothing, connect over USB adaptor, XCTU and re-flash firmware.
I know that the Xbee could be programmed via XCTU, but how can I program it THROUGH the Arduino (ie. when in use, change the destination address? Can I have sample code? That will clarify things a TON.
Go to command mode by sending escape characters (usually +++), then you can over AT commands set up what you want, then save it with ATWR and then escape from command mode by ATCN.
How would I send the commands via the Arduino only? (no computer) I tried serial.print("+++) on the arduino, but how do I read the output from xbee? Please help? I really need sample code.
//Will send escape characters and return 1 when sucesfull, gt in ms (try 1200, depends on setting of GT and CT reg)
boolean SendEscapeChar(int gt) {
delay (gt);
char buffer[8]="";
int i=0;
while (Serial.available()) Serial.read();
Serial.write("+++");
uint32_t sw=millis();
while (millis()<sw+gt) {
if (Serial.available()>0) {
buffer[i]=Serial.read();
i++; buffer[i]='\0';
if (!strcmp("OK\r",buffer)) return 1;
}
}
return 0;
}