diff --git a/examples/CC1101/CC1101_Receive/CC1101_Receive.ino b/examples/CC1101/CC1101_Receive_Blocking/CC1101_Receive_Blocking.ino similarity index 73% rename from examples/CC1101/CC1101_Receive/CC1101_Receive.ino rename to examples/CC1101/CC1101_Receive_Blocking/CC1101_Receive_Blocking.ino index e79ba1f0..32dbe6bf 100644 --- a/examples/CC1101/CC1101_Receive/CC1101_Receive.ino +++ b/examples/CC1101/CC1101_Receive_Blocking/CC1101_Receive_Blocking.ino @@ -1,19 +1,24 @@ /* - RadioLib CC1101 Receive Example + RadioLib CC1101 Blocking Receive Example - This example receives packets using CC1101 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 CC1101 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#cc1101 + Using blocking receive is not recommended, as it will lead + to significant amount of timeouts, inefficient use of processor + time and can some miss 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#cc1101 + + For full API reference, see the GitHub Pages + https://jgromes.github.io/RadioLib/ */ // include the library diff --git a/examples/CC1101/CC1101_Transmit/CC1101_Transmit.ino b/examples/CC1101/CC1101_Transmit_Blocking/CC1101_Transmit_Blocking.ino similarity index 65% rename from examples/CC1101/CC1101_Transmit/CC1101_Transmit.ino rename to examples/CC1101/CC1101_Transmit_Blocking/CC1101_Transmit_Blocking.ino index 4b2c9606..b01114a6 100644 --- a/examples/CC1101/CC1101_Transmit/CC1101_Transmit.ino +++ b/examples/CC1101/CC1101_Transmit_Blocking/CC1101_Transmit_Blocking.ino @@ -1,17 +1,21 @@ /* - RadioLib CC1101 Transmit Example + RadioLib CC1101 Blocking Transmit Example - This example transmits packets using CC1101 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 CC1101 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#cc1101 + 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#cc1101 + + For full API reference, see the GitHub Pages + https://jgromes.github.io/RadioLib/ */ // include the library @@ -43,11 +47,14 @@ void setup() { } } +// use a counter to keep track of transmitted packets +int count = 0; + void loop() { Serial.print(F("[CC1101] Transmitting packet ... ")); // you can transmit C-string or Arduino string up to 63 characters long - int state = radio.transmit("Hello World!"); + int state = radio.transmit("Hello World! #" + String(count++)); // you can also transmit byte array up to 63 bytes long /*