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?