Pages: [1]   Go Down
Author Topic: xbee receives but not send back data  (Read 557 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

i am trying to build a communication between 2 xbees. I am able to send from the one to another but now I want to send back to the other xbee.

Here is my receiver code:

Code:
void loop()  {
 if (xbee.available() > 0) {
    int char_read=xbee.read();
    if (char_read==65) {
          xbee.println('P');
          Serial.print("Character A received: ");
    } else {
      Serial.println("Waiting");
    }
 } else {
    Serial.println("Not available data");
 }
 delay(1000);
}

So I want when receiving 'A' to send back 'P'. I am getting 'A' since I see the message "character a received" but message is not sent back because i n my sender side always the reading value is -1.

It is like they cannot do at the same time both operations.

I am using XBee series 1.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49040
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't suppose you're planning to tell us how the XBees are configured in this thread, either.

Yes, the XBees CAN send and receive. An XBee receives from another one on the same PAN that has DL equal to its MY. It sends to whichever XBee has the MY address that it has as its DL.

If one XBee, we'll call it Fred, has PAN ID = 3128, MY = 8001, and DL = 4382, and another XBee, we'll call it Sue, has PAN ID = 3128, MY = 4382, and DL = 3329, then Sue will be able to receive from Fred, but will NOT be able to talk to Fred.

That really sounds like your situation. You need to get Fred and Sue on the same page.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1)So the correct configuration for this example is:

FRED: PAN ID:3128, MY=8001, DL=4382
SUE: PAN ID: 3128, MY=4382, DL= 8001?

And a little more on that since in the future I would like to expand it with ore:

I have FRED, SUE, NICK. I want Fred to send to everyone, and Sue and Nick to send back only to Fred.

2) I read somewhere that if you want the sending data to be received from all the XBee's with the same PAN ID, then DL and MY must be set to 0. So I left them to 0, and then whatever I send from from Fred can be read from every XBee, and whatever I send from Sue is not read by anyone? So what I did is something like:

(in pseudocode)

Code:
//fred code
 send("s"); or send("n");
...

//receiver code
if read=="s" then code for sue
else if read="n" code for nick.

And in the code for sue I have send("result"). But this is not send.

What configuration do I need?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49040
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1)So the correct configuration for this example is:

FRED: PAN ID:3128, MY=8001, DL=4382
SUE: PAN ID: 3128, MY=4382, DL= 8001?
Yes. Or any values, as long as PAN ID is the same on both and MY on one is DL on the other.

Quote
And a little more on that since in the future I would like to expand it with ore:

I have FRED, SUE, NICK. I want Fred to send to everyone, and Sue and Nick to send back only to Fred.
The FRED needs a MY value that SUE and NICK use as the DL value. SUE's and NICK's MY address doesn't matter. FRED's DL address will be 0xFFFF - the broadcast address.

I don't think that using 0 as MY or DL on any of the XBees is a good idea.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for answering all of my questions.

I will try them.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1)So the correct configuration for this example is:

FRED: PAN ID:3128, MY=8001, DL=4382
SUE: PAN ID: 3128, MY=4382, DL= 8001?
Yes. Or any values, as long as PAN ID is the same on both and MY on one is DL on the other.

Quote
And a little more on that since in the future I would like to expand it with ore:

I have FRED, SUE, NICK. I want Fred to send to everyone, and Sue and Nick to send back only to Fred.
The FRED needs a MY value that SUE and NICK use as the DL value. SUE's and NICK's MY address doesn't matter. FRED's DL address will be 0xFFFF - the broadcast address.

I don't think that using 0 as MY or DL on any of the XBees is a good idea.

it does not seem to work. Do I set all of the three to be end-devices or FRED must be co-ordinator? Does it make any difference?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49040
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do I set all of the three to be end-devices or FRED must be co-ordinator?
End device and coordinator are series 2 terms. Are you SURE you have, and are configuring, series 1 models?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do I set all of the three to be end-devices or FRED must be co-ordinator?
End device and coordinator are series 2 terms. Are you SURE you have, and are configuring, series 1 models?

yes sure. those terms where not visible in the X-CTU but I found them on a tutorial. Anyway since there is nothing else to configure either my connection are wrong or my XBee's stopeed working. I will check it out again since now I do not see any communication at all (not even the one I said in the first post that FRED could send to anyone but not was not able to read back).
Logged

Pages: [1]   Go Up
Jump to: