Cannot send and receive data between two Arduinos via XBee

Hello friends,
This is my first post in the forum and I will try to be precise.

My goal: Exchange data between two Arduinos using XBee.

Setup:

  1. Each Arduino is connected to a wireless shield with an XBee on it.
  2. Both Arduino’s are configured in AT mode. Both have latest firmware installed through XCTU.
  3. One Arduino is configured as a co-ordinator and the other as a router.

What is working:
When I connect a Tera Term to each Arduino over USB cable, what I type on one terminal can be viewed on the other terminal and vice versa. This means that the PAN ID and the DH and DL on each XBee is correctly set.

Information about sketches used:
I have attached two sketches. chat_send.ino sends some text and chat_receive.ino receives the text.

Problem:
The Arduino running chat_receive.ino does not receive any text since “Outside” is always printed on the Serial monitor.

In chat_send.ino, in line 23, I am printing the writeCount value which is 3 as it should be, which means that the text is being sent correctly.

I hope I have provided all the information. Any help will be highly appreciated.

Regards
Amit

chat_receive.ino (454 Bytes)

chat_send.ino (436 Bytes)