XBee (With SainSmart Sheild) reading string from Serial

I created an app that sends a series of strings through an XBee to an Arduino Mega (w/ a receiving Xbee attached to a SainSmart XBee shield.)

The XBee that Sends the information (Router) is working properly. When I connect the receiving XBee (coordinator) to X-CTU, it shows that the XBee is receiving the string values.

The Problem: When I connect the receiving Xbee to the Arduino, the Arduino is not reading those values from the XBee.

  • I switch the jumper back to XBEE
  • The XBees are configured correctly (because it IS receiving data w/out the Arduino

For the arduino, I am using the example code that comes with the IDE

void setup()
{

	Serial.begin(9600);

}

void loop()
{

	if (Serial.available())
	{
		
		Serial.println(Serial.read() );
	}
}

For the arduino, I am using the example code that comes with the IDE

Are you using the Serial port to talk to the XBee or to talk to the PC? Both is the wrong answer. So is yes.

I am trying to get the XBee to talk to the Arduino. The receiving XBee is mounted onto an adapter that is on the Arduino. The adapter sends the data from the XBee to the rx,tx (0,1) pins on the Arduino Mega.
In my case, something is stopping the info from being retrieved by the Arduino.

The XBee on the Arduino Is receiving info, its just not getting to the Arduino.

The XBee on the Arduino Is receiving info, its just not getting to the Arduino.

How do you know that? You are trying to use the same port to talk to the XBee and to the PC.

Ditch that useless shield, and get one that allows you to connect the XBee to some other pins.

When I connect the receiving XBee to XCTU, It shows that it is receiving. This Shield allows me to use a different Pin. I already tried changing to pin 12,13 rx,tx But it didn't work.

This Shield allows me to use a different Pin. I already tried changing to pin 12,13 rx,tx But it didn't work.

I have two of those shields, though I haven't used them in years.. I don't believe they let you choose the pins.

I saw a tutorial in which they removed the rx, tx pins from the shield (so they don't connect to the arduino) and hardwired from Dout, Din (from the XBee shield) to other pins on the Arduino.

I saw a tutorial in which they removed the rx, tx pins from the shield (so they don't connect to the arduino) and hardwired from Dout, Din (from the XBee shield) to other pins on the Arduino.

Is that what you did? What changes did you make to your code?

I did that just as a test (which failed.) I created my own serial port and specified what pins I chose as my tx, rx

I created my own serial port and specified what pins I chose as my tx, rx

How?

Why? The Mega has 4 hardware serial ports. Why not use one of the other three?

I used the other dedicated serial communication ports on the Mega.
Have you successfully communicated from XBee to Arduino? Is the RX Light on the arduino supposed to be on?

SoftwareSerial mySerial(15, 14); // RX, TX

Have you successfully communicated from XBee to Arduino?

Yes.

Is the RX Light on the arduino supposed to be on?

When using SoftwareSerial? No, of course not. That LED is connected to the Serial to USB converter.

Ok. Well, I ordered a different Shield just in case. But I must be doing something wrong.
Please, correct me if I am wrong.In order to check what information the Arduino is receiving, I would have to apply Serial.println(Serial.read()) and open the Serial Monitor?

Are you using the Serial port to talk to the XBee or to talk to the PC? Both is the wrong answer. So is yes.

The notion that an arduino serial port can't be connected to and communicate with both a pc and another device is BS.

Please, correct me if I am wrong.In order to check what information the Arduino is receiving, I would have to apply Serial.println(Serial.read()) and open the Serial Monitor?

If the XBee is connected to a SoftwareSerial instance, then reading from Serial won't get data from the XBee.

zoomkat:
The notion that an arduino serial port can't be connected to and communicate with both a pc and another device is BS.

The idea that it is trivial to keep track of where the data came from, and where it should go, when two devices share the same line is what is BS.

Then what is the proper way to receive data via XBee and display what the Arduino is receiving?
Also, I have both XBees configured in AT mode. Is that OK?