I am trying to make Xbee connected to Explorer USB to talk to Xbee Connected to Arduino, so I can achieve sending wireless command to arduino from my PC.
I am sure I have already configured two Xbees correctly using X-CTU.
On the arduino Mega 2560 side, I made following connections:
Xbee GND to Arduino POWER GND
Xbee 5V to Arduino POWER 5V
Xbee Dout to Arduino COMMUNICATION 0 (Rx0)
Xbee Din to Arduino COMMUNICATION 1 (Tx0)
My code for arduino is,
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);
void setup()
{
Serial.begin(9600);
Serial.println("XBee Example!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}
void loop() // run over and over
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
When I connect the other Xbee to PC through explorer USB, and I switch the working mode of X-CTU to consoles working mode, and try to type something on console log. But nothing shows up on arduino side when i open the serial window, except "XBee Example!".
Ahhh have been stuck with this for a few days. Anyone got an idea?