Go Down

Topic: (Arduino+two xbee pro )-Rx...(Arduino+one xbee pro)Tx (Read 1 time) previous topic - next topic


i have some problem about how receiving data by using two XPB24Z7 'xbee pro'
Note : am using SoftwareSerial.h to can connect the two xbee to one arduino 'uno' and using more than Tx and Rx at the arduino
,they are connected to same arduino 'uno' and data transmit from third xbee pro connected to another arduino 'uno' or pc
arduino code for Rx

#include <SoftwareSerial.h>

SoftwareSerial mySerial1(10, 11); // RX, TX
SoftwareSerial mySerial2(2, 3); // RX, TX
void setup() {

pinMode(13, OUTPUT); //set pin 13 as output

void loop() {
// mySerial1.println("Hello, world?");
// delay(1000);

while(mySerial1.available()){ //is there anything to read?
char getData = mySerial1.listen(); //if yes, read it
if(getData == 'a'){
digitalWrite(13, HIGH);
}else if(getData == 'b'){
digitalWrite(13, LOW);


Code: [Select]
SoftwareSerial mySerial1(10, 11); // RX, TX
SoftwareSerial mySerial2(2, 3); // RX, TX

You have two mySerials connected to the Arduino. Got it. Where do the XBees come in?

Code: [Select]
char getData = mySerial1.listen(); //if yes, read it
Listening and reading are not the same thing. There is no data available if you are not listening.

Why are there two XBees connected to one Arduino? One XBee can send AND receive.
The art of getting good answers lies in asking good questions.


first thnx for helping
am using two xbee because i need to do function at my project that ' will receive data from the first xbee which at distance from the second xbee which connected at the same arduino and by calculating the distance between them and timing of receiving the data i can calculate the speed of the object (arduino) that hold the another third xbee Tx '   

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131