I found an NRF24L01 transmitter program online, and I am quite confused on how the msg[1] array works, can anyone explain to me what that does. Can someone also explain to me how radio.write(msg, 1) works?
I understand what the pipe, radio, and button is but I do no understand what the msg[1] does, and I do not understand why it says msg[0] = 111, it would be helpful if someone could explain that part to me too. I also do not quite understand digital.write(msg, 1). I do not get what the parameters msg and 1 do.
array msg, location [0] has been assigned a value of 111
digital.write(msg, 1) doesn't appear in what you posted, perhaps you meant radio.write(msg, 1)?
If so, it's passing the message array to radio.write, and indicating only one value is to be sent. That means the first value in the array is to be sent, the value that was written to msg[0].
Remember, in C/C++, arrays are zero-based; that is, the first value in an array is at location 0.
At least, that's how I read it.
That's wrong. If it appears to "work" it's only because the processor is little -Endian and you put a value less than 256 into the variable. It should be: radio.write(msg, sizeof(msg));