Note the black X, and how the I2C pins line up in this orientation. Power is coming in the back |
I installed Coolterm from http://freeware.the-meiers.org/ so I could run a serial terminal outside the Arduino IDE.
I installed the FTDI drivers from http://www.ftdichip.com/Drivers/VCP.htm so that the FTDI cable would interface with my USB and behave like a serial port.
I started coolterm, picked the right port under options, connected and could get recognition of +++ [No Enter] with an OK. I started with a series of queries and responses on the black X-Bee. (With the X blacked out, same for the one with the B blacked out)
Things I Type [normally followed by Enter] that don't show up on the terminal
Things The black X-Bee Sends Back
+++[No Enter]
OK
AT
OK So the X-Bee is responding, but it will time out and need a +++ again soon
ATID
3332 is what the PANID was set to before (out of the box default)
ATID2711
OK Sets PANID to 2711, could be any 4 digits, but must be the same for all units on network
ATMY
0 This X-Bee is unit 0
ATDL
0 The destination X-Bee is unit 0
ATDL1
OK Set the destination X-Bee to unit 1
ATBD
3 The baud rate is set to 9600 and I'll leave it there
ATWR
OK Writes all the changes to permanent, otherwise they would disappear at power off
Disconnected, then unplugged USB and changed over to the white X-Bee. Did all the same things, except ATMY1 and ATDL0 to reverse the roles.
Then I connected the black X-Bee RX and TX to RX and TX on an Arduino (turns out they should be TX-RX, RX-TX). Something was happening, but not the right things. http://www.ladyada.net/make/xbee/arduino.html suggests the programming communications won't work to upload to an UNO (just with a Duemilanove bootloader), or that the baud rate should be higher (ATBD6 - 57600 for a newer Arduino with a '328). One problem at a time...
void setup() {The code above will echo characters back 1 second after they're sent. Loaded and tested over USB, then disconnected and powered the Arduino by batteries, connected coolterm to the white X-Bee on the FTDI and it didn't work. Switched the connections so that black X-Bee RX went to Arduino TX and black X-Bee TX went to Arduino RX, and things started working.
Serial.begin(9600);
delay(1000);
Serial.println("Hello World! Now to Echo");
}
void loop() {
if(Serial.available()){
char c = Serial.read();
Serial.print("Another new character: ");
delay(1000);
Serial.println(c);
}
}
So now that I have wireless serial at 9600 baud, do I want to get wireless programming working, or just work on wireless links between Arduinos? Start with upping the speed on both to ATBD6 - 57600. And then remember to up the sketch baud rate too... and presto, it works. Up to ATBD7 - 115200 and that works too, but gets flaky, so I'll slow it down to ATBD6 - 57600. (Yes, there's a reason why this might read like a lab notebook ;-) )
Wireless programming seems like a lot more effort with the extra pins to worry about, so I'll tackle that when I need it.