Pages: [1]   Go Down
Author Topic: Get address from incoming Xbee packet using Xbee library  (Read 1876 times)
0 Members and 1 Guest are viewing this topic.
Boston
Offline Offline
God Member
*****
Karma: 3
Posts: 575
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I need a nudge in the right direction.
I am using 3 series 2 xbee radios.  2 set up as routers in AT mode and 1 as the coordinator in API mode. 
I need to identify which radio is sending a packet to the coordinator. 
I am using the Xbee library  I/O sample code and an LCD screen.

If I use the following line of code,
Code:
LCD.print(ioSample.getRemoteAddress64().getLsb(), HEX);
I get the lower part of the sender's address, 407AIF83
How do I get this into a variable or string so I can compare it?
If I use the following line of code to put it into a string, all I get is the # 16.
Code:
String radioID =(ioSample.getRemoteAddress64().getLsb(), HEX);
I get the number 16, instead of a string like 407AIF83.
Really want I want to end up with is a statement like the following pseudo code

if (ioSample.getRemoteAddress64().getLsb(), HEX) == '407AIF83')
{
   do x;
}

else
{
 do Y;
}

Any help is appreciated.
Thanks.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 110
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The class XBeeAddress has a toString() method which might give you exactly what you need?
Logged

Boston
Offline Offline
God Member
*****
Karma: 3
Posts: 575
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks TomS  but,
I can't seem to find  toString() in the Xbee library.
Anyone have any examples or point me to where it is in the library?
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 110
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, according to the API it should be there.

So this doesn't work for you?
Code:
String radioID = ioSample.getRemoteAddress64().toString();
Logged

Boston
Offline Offline
God Member
*****
Karma: 3
Posts: 575
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, the message I get is:
'Class XBeeAddress64' has no member name 'toString'
Logged

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

Hi Pauly, do you solve this problem? I found that I met the same problem with you. Could you please tell me how to solve it?
Logged

Pages: [1]   Go Up
Jump to: