Communicating Between Two Arduino Fios with XBees

My project uses two Arduino Fios, each with an XBee attached to them. I'm also using another XBee and USB dongle to program the Arduinos from my computer and debug the code with the Serial Monitor.

Hypothetically my application takes an accelerometer event from the first Fio and transmits it to the second Fio. Right now both Arduinos are sending all serial messages back to the computer through the Arduino Serial Monitor. I can send commands to both Fios, but I can't send a command from one Fio to the next.

XBee Settings

PANID identical

Programer
MYID is 0000
DLID is FFFF

Device One
MYID is 0001
DLID is 0002
Device Two
MYID is 0002
DLID is 0001

The accelerometer and LED code is fairly complicated so I won't post it here. But...

I'm sending Serial.write(int); in the TX code on an accelerometer double tap event.

The RX code that listens to incoming messages.

if (Serial.available() > 0) {
// read the incoming byte:
//Serial.write(Serial.read());
incomingByte = Serial.read();
if (incomingByte == 97)
{
snapCount = 1;
}
else if (incomingByte == 98)
{
snapCount = 2;
}
else if (incomingByte == 99)
{
snapCount = 3;
}
// say what you got:
Serial.print("Receiver received: ");
Serial.println(incomingByte, DEC);
Serial.println(snapCount, DEC);
}

Communication isn't working at all, except between the computer and the Arduinos.

How can I send a discrete message to just one of the Arduinos, preferably the second device?

I've read a few ways to do this with XBee AT commands and sending a pin high and low. Is there a better/easier way?

What is the best way to to go about this?

Two ways come to mind:

  1. You can use AT commands from the computer to change the settings on the Programmer XBee and change the DLID to match the MYID of the particular Fio XBee you want to talk to at that time. The drawback is that you have to have a gap before you send +++ and a gap afterward, and then you send ATDL 000x(enter) and then ATCN (enter) where 000x is the ID you want to talk to. The XBee allows these gaps to be changed, speeding up the process.
  2. You can change your Programmer XBee into "API Mode" and use the Arduino XBee API library (try this one, but there are probably others: GitHub - andrewrapp/xbee-arduino: Arduino library for communicating with XBee radios in API mode) and you can change the DL address with every packet.
    Hope that helps
    Jeremy

Please support the Open-Source Radio Module project: http://kickstarter.extrabee.org

Thank You!

I needed reassurance that it was fairly complicated.

I used a simple serial listener in Processing instead. Works great, maybe better.