My code currently has 4 radio.write() functions in successions, and I placed a delay of 100ms between them, and when I check the receiver, the radio.read() function skips one or two of the data written by the radio.
For example, let's say on the transmitter side, i placed radio.write temp, then radio.write humidity, radio.write lux, and radio.write gas sensor value.
And on the receiving side, when the transmitting arduino has been turned on for a while, it can read the values of the transmitter, but then later in the loop, it continuously reads only temp, then skips over to gas for a random amount of time, etc. Pretty much perform completely random reads.
Furthermore, sometimes the data as well isn't real-time, i.e. like I'd have to wait 5,10,12 seconds for the humidity to update after blowing air into the sensor
What's the problem here? I thought the delay would make it so that the radio will not get overwhelmed by the amount of data. Increasing the delay doesn't seem to do much too. I am also writing all these data into one pipe, because radio.write() function only writes to one pipe in one program.
The reason for these multiple radio.write() is because I have a lot of data to send that is more than 32 bytes each. The OP is just an example. I am sending these data in an array.
Hi Whandall,
In that post, I had radio1 to radio9 which probably wasn't the best idea to do so..
But now I have only one radio initialised on both the rx and tx, and I managed to separate the data using a char array.
Now I am currently facing another issue, which is explained in the OP.
@Whandall Sorry if I seemed like that, and thank you.
To anyone who might have the same problem, I initialised radio.openwritingpipe() based on an if statement
e.g. set addr1 = 0xF0F0F0F0A0LL, addr2 = 0xF0F0F0F0A1LL
and if int pipe1 = 1, then radio.openwritingpipe(addr1),
else if int pipe2 = 1, then radio.openwritingpipe(addr2)
on the receiver side, i would then have two radio.openreadingpipe(), that are radio.openreadingpipe(1,addr1) and
radio.openreadingpipe(2,addr2).