Go Down

Topic: How do I send some data with NRF905? (modules working, just a software question) (Read 276 times) previous topic - next topic

torestabell

You, Sir, are a genious wizard and magician! Now I can send doubles, longs and whatever from one nrf905 to the other.
That saves my day, week, month and year! You have no idea how much time I have spent trying to figure that out.

Than you so much for your super help!


T

cattledog

I'm glad you worked it out.

Unfortunately different libraries have slightly different syntax. VirtualWire, and the follow on RadioHead use the byte cast wth
Code: [Select]
xxx.send((uint8_t*)&dataToSend, sizeof(dataToSend))

I think that the TMRh20 version of the RF24 library and the ManiacBug RF24 library used with the nRF24L01 radios use
Code: [Select]
radio.write(&dataToSend, sizeof(dataToSend))

On the receive, you can use memcpy to transfer the bytes from  the standard library receive buffer into the data structure you want, or receive directly to the memory address of the data structure.

torestabell

thank you so much, the sollution you came up with works very well.

T

Go Up