Is it needed to send the size of text when using the NRF24L01?

So I have this code and I am using it to send data using NRF24L01 modules.
One code line got me confused.
radio.write(&text, sizeof(text));
It is sending the constant char named text which is ok but after that, it is sending the sizeof(text) but is it needed? I don't need to use it but because all the sample codes I got on the internet, had it so I didn't feel like removing it.
Now, I haven't got my modules yet so I am also a bit sceptical that if sizeof(text) will actually print out the size of the text.

radio.write() can write data of any kind, each of which may be made up of a different number of bytes hence the length to be sent is needed

Take a look at how the data is read in the receiver code for the corresponding use of the length on receipt of the data

You don't need the modules to print the length of a piece of text. Try it for yourself, but don't forget that the text will have a '\0' added to it marking the end of the text and that its length will include that termination character

1 Like

Remember that the maximum packet size is 32 bytes.

The packet size on the air will be fixed at 32 bytes, unless you
use dynamic payloads by calling radio.enableDynamicPayloads().

1 Like