Hardware Reference
In-Depth Information
Note
To change the code to send a command byte, look for the following code that gets the mil-
liseconds from the time function and sends it out to the other Arduino:
// Take the time, and send it. This will block until
complete
unsigned long time = millis();
printf("Now sending %lu...",time);
bool ok = radio.write( &time, sizeof(unsigned long));
Now, change the code on the sending Arduino so that instead of sending the time, it sends
a command byte that you define. Then, on the receive Arduino, look for the following
code:
// Grab the response, compare, and send to debugging spew
unsigned long got_time;
radio.read( &got_time, sizeof(unsigned long) );
// Spew it
printf("Got response %lu, round-trip delay:
%lu\n\r",got_time,millis()-got_time);
Finally, change this code to take the command byte that you defined and then trigger some
action.
Search WWH ::




Custom Search