A few questions regarding nRF24l01p module and TMRh20's lib

Hi,

I'm using TMRh20's RF24 library to communicate between two arduinos with nrf24 modules and have a few questions after reading several guides.

  1. I'm having a hard time understanding how to read data with the library. I have successfully used example sketches, but I don't understand how they work. I don't understand how data buffers work or how to use pointer operators as used in the examples. Could someone please explain this to me? Why is it not like serial communication where it works to do "int i = Serial.parseInt()"?

  2. How do I read data as ASCII vs an integer vs a float?

  3. How do pipe addresses work? Is it just a random set of bytes that just have to match in the code of each arduino? Do certain pipes eliminate interference from wireless appliances and such?

Thank you, your help is appreciated.

An nRF24 just sends a series of bytes. It is up to the Arduino to interpret them.

The simplest way to send bytes is to put them in an array and send the array. If you put the data in an array you don't need to worry about pointers because C/C++ treats an array name as a pointer. See the pair of programs in this link.

If you want to send a mix of ints and floats you can use a struct and a union. A union allows the same data to be viewed in different formats - for example an array of bytes as well as a float.

The pipe address is just the ID number of the device you want to send data to (like a phone number). The address has nothing to do with interference.

If you are suffering interference try a different channel. Each channel uses a different frequency. However many pairs of nRF24s can operate on the same channel without upsetting each other if they use different addresses.

...R

Thanks for your help. It makes more sense now.