I configured two XBees using XCTU, connected them to the computer and sent Bytes back and forth. Works.
This is the current, non-working setup:
1 XBee, connected to the Computer using a SparkFun XBee Explorer USB.
1 XBee, connected to an Arduino Mega using SparkFun XBee Explorer Regulated
GND to GND
5V to 5V on the Arduino
DOUT to TX1 on the Arduino
DIN to RX1 on the Arduino
void setup() {
Serial1.begin(9600);
pinMode(13, OUTPUT);
//After 3 seconds the XBee should send out a couple of "A"s coming from the serial port
delay(3000);
int i = 0;
while (i < 10) {
Serial1.print("A");
delay(100);
i++;
}
}
void loop() {
//If anything is sent to the XBee it should appear in the Arduino's serial buffer
//making the LED on pin 13 turn on
if (Serial1.available() > 0) {
digitalWrite(13, HIGH);
}
}
The DOUT LED on the Explorer Regulated flashes as supposed to but nothing is received on the computer where my Terminal application is listening.
Same when I send something from the Terminal, the LED on pin 13 of the Arduino does not indicate any bytes in the buffer, meaning that the XBee probably never received anything.
I already tried swapping TX & RX, resulting in the DIN LED blinking instead of DOUT. Transmission still not working.
DOUT
is an output of XBee, so it should go to the input of Arduino, which is RX, rather than TX. First fix this. BTW, make sure you don't have any hard/soft flow control – Eugene Sh. Nov 2 '15 at 17:57