On my system (IDE 1.8.5), your combo code in reply #43 does not compile with the following error
C:\Users\sterretje\AppData\Local\Temp\arduino_modified_sketch_560605\sketch_may05a.ino: In function 'void loop()':
sketch_may05a:130: error: void value not ignored as it ought to be
done = radio.read(msg, 1);
^
Same for the oter code in that reply. Maybe you're using a different compiler (IDE) or a different version of the library.
Why did you implement a while loop? There is no need for it unless your message is longer than one byte in which case you anyway have a bug in your code (your transmitter and receiver code don't match in that case).
Just take the done flag out; modified
// RADIO CODE
if (radio.available()) {
radio.read(msg, 1);
if (msg[0] == 111) {
DoorIsOpen = true;
DoorIsClosed = false;
}
if (msg[0] == 112) {
DoorIsClosed = true;
DoorIsOpen = false;
}
}
That simply checks if there is data available and if so, read one byte and process it. If more bytes were received, the next time that your code gets to the if, it sees that there is still data and will read it and process it. That should not pose an issue.
I can't say for sure why the one code works and the other one not.