ZBTxRequest XBEE

Hello,

I am working on a project where i have an arduino as a coordinator for multiple arduino with xbee routers. I am using the xbee library for API communication.

I need to send different messages to the xbee routers and i need to create a function to create my ZBTxRequest because i have a lot of messages and i dont want to declare all of them.

my function is like this:

ZBTxRequest ZBTx (XBeeAddress64 x, char y, char t) {

uint8_t z[2];

z[0] = y; z[1] = t;

ZBTxRequest s = ZBTxRequest (x,z,sizeof(z)); return s; }

and i call it in the loop like this:

xbee.send(ZBTx(jola1,'a','1'));

jola1 beeing a XBeeAddress64

the error i receive is "no matching function for call to 'XBee::send(ZBTxRequest)"

what am i doing wrong? the creation of the function or the way i call it?

I have made it work. In the call function i declared

ZBTxRequest ZB = ZBTx(jola1,'a','1'); xbee.send(ZB);

and it sends me to the other xbee.

My problem is that i dont receive the values i want. As i researched i think I am converting char to uint_8 wrong.

Can someone please help me?

My problem is that i dont receive the values i want.

That's certainly a shame. Perhaps if you posted ALL of your sender code, and ALL of the receiver code, and an example of what is sent and an example of what is received, we might be able to help you.

Hello,

In my first post i put all the sender code.

The receiver works because i receive from other xbees.

After some research i found that the problem is with variables.

ZBTxRequest ZBTx (XBeeAddress64 x, char y, char t)

Here i define chars, but i have to put them in an array of uint8_t - z. And here i have problems. I think it's a conversion problem.

How can i convert a variable from char to uint8_t??

How can i convert a variable from char to uint8_t??

char and uint8_t are the same size, so a simple cast is all that is required.

As to why it does not work for you, who knows. And, really, if you can't post you code, who cares.