Go Down

Topic: Newbie Xbee communication issue (Read 37 times) previous topic - next topic

bisctboy

I just received 2 Xbee series 1 units yesterday. I downloaded the XCTU software and followed the Sparkfun tutorial ( https://learn.sparkfun.com/tutorials/xbee-shield-hookup-guide ) for setting up the Xbee shield and Xbee Explorer. Everything worked correctly and whatever I typed in the Arduino serial monitor gets sent to the XCTU monitor. The same is true from the XCTU monitor to the Arduino serial monitor.

I now want to take it a step further and have 2 Arduino's talk to each other over the Xbee modules. This is where I am having the issue and can't get it to work. I spent last night and this morning researching and trying to get it to work with no luck. My setup is this:


Arduino #1 hooked up to my computer with the below code:

#include <SoftwareSerial.h> // SoftwareSerial to communicate with the XBee's

SoftwareSerial XBee(2, 3); // RX, TX

void setup()
{
  XBee.begin(9600);
  Serial.begin(9600);
}

void loop()
{
  if (Serial.available())
  {
    XBee.write(Serial.read()); // Data comes in from serial monitor, send it out to XBee
  }
  if (XBee.available())
  {
    Serial.write(XBee.read()); // Data comes in from XBee, send it out to serial monitor
  }
}


Arduino #2 hooked up to a 9V battery with the below code:

#include <SoftwareSerial.h> // SoftwareSerial to communicate with the XBee's

SoftwareSerial XBee(2, 3); // RX, TX

void setup()
{
  XBee.begin(9600);
  Serial.begin(9600);
}

void loop()
{
  if (Serial.available())
  {
    XBee.write(Serial.read()); // Data comes in from serial monitor, send it out to XBee
  }
  if (XBee.available())
  {
    Serial.write(XBee.read()); // Data comes in from XBee, send it out to serial monitor
  }
  Serial.println("Xbee");
  delay(500);
  Serial.println("Communicating");
  delay(500);
}

Obviously the setup has the remote Arduino #2 sending data that should be able to be read over the local Arduino #1 serial monitor.

On both Xbee's the settings are identical...CH = C, ID = 3332, DH = 0, DL = 0, MY = 0. I did not change anything else on the configurations in XCTU.

What am I doing incorrectly?

Marshall

Go Up