diff --git a/examples/RF69/RF69_Receive/RF69_Receive.ino b/examples/RF69/RF69_Receive_Blocking/RF69_Receive_Blocking.ino similarity index 70% rename from examples/RF69/RF69_Receive/RF69_Receive.ino rename to examples/RF69/RF69_Receive_Blocking/RF69_Receive_Blocking.ino index f38dcc44..a886b87d 100644 --- a/examples/RF69/RF69_Receive/RF69_Receive.ino +++ b/examples/RF69/RF69_Receive_Blocking/RF69_Receive_Blocking.ino @@ -1,19 +1,24 @@ /* - RadioLib RF69 Receive Example + RadioLib RF69 Blocking Receive Example - This example receives packets using RF69 FSK radio module. - To successfully receive data, the following settings have to be the same - on both transmitter and receiver: - - carrier frequency - - bit rate - - frequency deviation - - sync word + This example receives packets using RF69 FSK radio module. + To successfully receive data, the following settings have to be the same + on both transmitter and receiver: + - carrier frequency + - bit rate + - frequency deviation + - sync word - For default module settings, see the wiki page - https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 + Using blocking receive is not recommended, as it will lead + to significant amount of timeouts, inefficient use of processor + time and can miss some packets! + Instead, interrupt receive is recommended. - For full API reference, see the GitHub Pages - https://jgromes.github.io/RadioLib/ + For default module settings, see the wiki page + https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 + + For full API reference, see the GitHub Pages + https://jgromes.github.io/RadioLib/ */ // include the library diff --git a/examples/RF69/RF69_Transmit/RF69_Transmit.ino b/examples/RF69/RF69_Transmit_Blocking/RF69_Transmit_Blocking.ino similarity index 71% rename from examples/RF69/RF69_Transmit/RF69_Transmit.ino rename to examples/RF69/RF69_Transmit_Blocking/RF69_Transmit_Blocking.ino index 8c6866d6..c229a74e 100644 --- a/examples/RF69/RF69_Transmit/RF69_Transmit.ino +++ b/examples/RF69/RF69_Transmit_Blocking/RF69_Transmit_Blocking.ino @@ -1,17 +1,21 @@ /* - RadioLib RF69 Transmit Example + RadioLib RF69 Blocking Transmit Example - This example transmits packets using RF69 FSK radio module. - Each packet contains up to 64 bytes of data, in the form of: - - Arduino String - - null-terminated char array (C-string) - - arbitrary binary data (byte array) + This example transmits packets using RF69 FSK radio module. + Each packet contains up to 64 bytes of data, in the form of: + - Arduino String + - null-terminated char array (C-string) + - arbitrary binary data (byte array) - For default module settings, see the wiki page - https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 + Using blocking transmit is not recommended, as it will lead + to inefficient use of processor time! + Instead, interrupt transmit is recommended. - For full API reference, see the GitHub Pages - https://jgromes.github.io/RadioLib/ + For default module settings, see the wiki page + https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 + + For full API reference, see the GitHub Pages + https://jgromes.github.io/RadioLib/ */ // include the library @@ -59,11 +63,14 @@ void setup() { */ } +// counter to keep track of transmitted packets +int count = 0; + void loop() { Serial.print(F("[RF69] Transmitting packet ... ")); // you can transmit C-string or Arduino string up to 64 characters long - int state = radio.transmit("Hello World!"); + int state = radio.transmit("Hello World! #" + String(count++)); // you can also transmit byte array up to 64 bytes long /* diff --git a/examples/RF69/RF69_Transmit_Interrupt/RF69_Transmit_Interrupt.ino b/examples/RF69/RF69_Transmit_Interrupt/RF69_Transmit_Interrupt.ino index cd29c59c..68ba0d93 100644 --- a/examples/RF69/RF69_Transmit_Interrupt/RF69_Transmit_Interrupt.ino +++ b/examples/RF69/RF69_Transmit_Interrupt/RF69_Transmit_Interrupt.ino @@ -96,6 +96,9 @@ void setFlag(void) { transmittedFlag = true; } +// counter to keep track of transmitted packets +int count = 0; + void loop() { // check if the previous transmission finished if(transmittedFlag) { @@ -128,14 +131,14 @@ void loop() { Serial.print(F("[RF69] Sending another packet ... ")); // you can transmit C-string or Arduino string up to - // 256 characters long - transmissionState = radio.startTransmit("Hello World!"); + // 64 characters long + transmissionState = radio.startTransmit("Hello World! #" + String(count++)); // you can also transmit byte array up to 64 bytes long /* byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; - int state = radio.startTransmit(byteArr, 8); + transmissionState = radio.startTransmit(byteArr, 8); */ } }