Hello forum, got some really embarrassing questions. It seems everyone has trouble getting two xbees talking to each other, I have managed to mess up a monologue. Here goes.
I got an xbee shield & xbee similar to this one (not actually from that shop but it looks identical, got mine from a phyisical shop).
I downloaded X-CTU and after immense amounts of trouble managed to upload into it and set it up as ZIGBEE ROUTER/END DEVICE AT. In X-CTU's terminal, it responds to +++ and replies to AT commands.
So far so good.
Now, I thought I 'd take tiny little baby steps and try chatting between the Arduino and the shield (as opposed to between XBee-ed Arduinos) since I only have one Arduino (Duemilanove) right now.
So, the last section on Arduino's XBee shield reference page ("Configuring the Xbee Module") seems to imply that it's fairly easy for the Arduino to get the XBee into configuration mode and then have a talk via AT commands. Well...
First sign of trouble, shield on top, jumpers to "XBee", when trying to upload any sketch, the IDE reports that:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
Damn! I haven't seen anyone else reporting you have to have the shield off when uploading but maybe I haven't been looking. So, first question, do you?
Anyway, I can upload the damn thing and then stick the shield on so that kinda works, till I hit the next obstacle, with the shield on, weird chars appear in the IDE's monitor (baud rate is checked). Sometimes most of these go away with a few delay() statements thrown around the code but sometimes everything is gibberish. So, question number two, WTF?
Still, I have an LCD and I 'm not afraid to use it. The shield allows access to pins 8-13 so I requisitioned 12 and 13 for NewSoftSerial and fed the following sketch to my board:
#include <NewSoftSerial.h>
NewSoftSerial LCD(12, 13);
const int bufferSize = 10;
char ca[bufferSize];void setup() {
Serial.begin(19200);
LCD.begin(9600);LCD.print(12, BYTE);
Serial.print("+++");delay(10000); // normally one second should be enough for XBee to answer but let it breathe
int i = 0;
while(Serial.available() > 0) {
ca[i++] = Serial.read();
LCD.print("."); // show if there's activity
}
ca = '\0';
- LCD.print(ca);*
- LCD.print("end"); // if this prints alone, nothing got received*
}
void loop()
{
}
[/quote]
Just a couple of comments, LCD.print(12, BYTE); clears the LCD. Serial.begin(19200); is just a value I got at some Arduino/XBee tutorial (can't find it now) since I didn't have a clue what kind of baud rate the Arduino/XBee chatter should be at. Is that an OK value?
Now, no prizes for guessing that the code prints a single "end" and that's it. So, I 'm out of ideas. Any help would be greatly appreciated.