Arduino UNO to Xbee <------------->Xbee to Arduino MEGA

Hi everyone

Im trying to send strings from Serial monitor in Arduino UNO, then with SoftwareSerial Send these values to Xbee.Serial() in a basic configuration point to point. So the values received from the sender, receive them in the other Xbee2.serial() and Use the strings in arduino mega with a external power supply to move some steppers.

in xbee's config

Xbee1 xbee2
ID 3332 (default), MY=1 DL0 ---------- ID 3332 MY=0 Dl=1

and the Arduino config

(Arduino mega Receiver Xbee )

#include <SoftwareSerial.h>

// Connect pin 10 of Arduino to DOUT of Wireless Proto shield
uint8_t ssRX = 10;

// Connect pin 11 of Arduino to DIN of Wireless Proto shield
uint8_t ssTX = 11;

SoftwareSerial nss(ssRX, ssTX);

void setup() {
Serial.begin(9600);
nss.begin(9600);
Serial.println("Serial works");
}

void loop() {

if (nss.available()>0){
char x=nss.read();
Serial.write(x);
}

}

And the sender is the same with the difference (RX TX 2 &3 ) in xbee shield

... if (Serial.available()>0)
char s=Serial.read()
nss.write(s)....

Well i Hope you understand me, i really need to use xbees radio for a project.

Greetings from Chile.

Using 0 and 1 and the MY and DL addresses is a bad idea. Use other values, like 1000 and 1001. 0 has a specific meaning.

Thanks PaulS,i will considerate it. but i have some doubts with the transmission. Is possible in ATmode config the radios like a chat? because i need
send strings and receive it in Matlab and arduino simultaneously to move a machine, or i really need Api mode ?

Is possible in ATmode config the radios like a chat? because i need
send strings and receive it in Matlab and arduino simultaneously to move a machine, or i really need Api mode ?

The only times you NEED API mode are when the XBee is getting data from an input pin or sending data to an output pin, or when you need to know which XBee sent a message or you need to send a message to a specific XBee (only relevant when there are more than two XBees involved).

With just 2 XBees and no pins on the XBees defined as I/O pins, AT mode is sufficient.

Thanks so much Pauls, i will considerate your advices, i will try changing the DL and MY with the same program.
i hope it works.

greetings from chile :slight_smile: