I am about to start experimenting with the code in maniacbug's article ( 2.4GHz RF Radio Transceivers and Library | maniacbug ) which uses the rf24 library, and appears to be exactly what I am looking for.
But there are 2 small things that I am unsure of, and was hoping that someone could enlighten me please :
-
the article talks about 'Transmit Role' and 'Receive Role'. The transceivers are both. Is the article slightly mis-leading in these terms and could be better called 'Master' and 'Slave' roles ? If I understand correctly, the first role sends the millis and waits for the response, and the second role waits for the master to send the millis and replies with sending the same value back ( like ping-pong ).
-
the code for the 'receiver' ( slave role ) has this code :
unsigned long got_time;
boolean done = false;
while (!done)
{
// Fetch the payload, and see if this was the last one.
done = radio.read( &got_time );
// Spew it
printf("Got payload %lu...",got_time);
}
Does this not mean that the execution of the sketch is stuck in this while loop until it has received a payload from the transmitter / master unit ?
If this is the case, how could this be changed so that the rest of a sketch could continue to loop ? ( I do not want to 'freeze' my sketch at this point just waiting for data to arrive from the transmitter when it may not receive data from the transmitter for 5 minutes ).
Regards