Go Down

Topic: Get address from incoming Xbee packet using Xbee library (Read 1 time) previous topic - next topic

Pauly

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: [Select]
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: [Select]
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.

TomS

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

Pauly

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?

TomS

Well, according to the API it should be there.

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

Pauly

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

ls815win

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?

Go Up