[SX127x] Renamed basic examples to _Blocking

This commit is contained in:
jgromes 2023-06-24 22:12:53 +02:00
parent 24be1747d0
commit c919185849
4 changed files with 70 additions and 59 deletions

View file

@ -1,19 +1,24 @@
/* /*
RadioLib SX127x Channel Activity Detection Example RadioLib SX127x Blocking Channel Activity Detection Example
This example scans the current LoRa channel and detects This example scans the current LoRa channel and detects
valid LoRa preambles. Preamble is the first part of valid LoRa preambles. Preamble is the first part of
LoRa transmission, so this can be used to check LoRa transmission, so this can be used to check
if the LoRa channel is free, or if you should start if the LoRa channel is free, or if you should start
receiving a message. receiving a message.
Other modules from SX127x/RFM9x family can also be used. Other modules from SX127x/RFM9x family can also be used.
For default module settings, see the wiki page Using blocking CAD is not recommended, as it will lead
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem to significant amount of timeouts, inefficient use of processor
time and can some miss packets!
Instead, interrupt CAD is recommended.
For full API reference, see the GitHub Pages For default module settings, see the wiki page
https://jgromes.github.io/RadioLib/ https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library

View file

@ -1,23 +1,28 @@
/* /*
RadioLib SX127x Receive Example RadioLib SX127x Blocking Receive Example
This example listens for LoRa transmissions using SX127x Lora modules. This example listens for LoRa transmissions using SX127x Lora modules.
To successfully receive data, the following settings have to be the same To successfully receive data, the following settings have to be the same
on both transmitter and receiver: on both transmitter and receiver:
- carrier frequency - carrier frequency
- bandwidth - bandwidth
- spreading factor - spreading factor
- coding rate - coding rate
- sync word - sync word
- preamble length - preamble length
Other modules from SX127x/RFM9x family can also be used. Other modules from SX127x/RFM9x family can also be used.
For default module settings, see the wiki page Using blocking receive is not recommended, as it will lead
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem 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 For default module settings, see the wiki page
https://jgromes.github.io/RadioLib/ https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library
@ -53,9 +58,6 @@ void loop() {
Serial.print(F("[SX1278] Waiting for incoming transmission ... ")); Serial.print(F("[SX1278] Waiting for incoming transmission ... "));
// you can receive data as an Arduino String // you can receive data as an Arduino String
// NOTE: receive() is a blocking method!
// See example ReceiveInterrupt for details
// on non-blocking reception method.
String str; String str;
int state = radio.receive(str); int state = radio.receive(str);

View file

@ -1,19 +1,23 @@
/* /*
RadioLib SX127x Transmit Example RadioLib SX127x Blocking Transmit Example
This example transmits packets using SX1278 LoRa radio module. This example transmits packets using SX1278 LoRa radio module.
Each packet contains up to 255 bytes of data, in the form of: Each packet contains up to 255 bytes of data, in the form of:
- Arduino String - Arduino String
- null-terminated char array (C-string) - null-terminated char array (C-string)
- arbitrary binary data (byte array) - arbitrary binary data (byte array)
Other modules from SX127x/RFM9x family can also be used. Other modules from SX127x/RFM9x family can also be used.
For default module settings, see the wiki page Using blocking transmit is not recommended, as it will lead
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem to inefficient use of processor time!
Instead, interrupt transmit is recommended.
For full API reference, see the GitHub Pages For default module settings, see the wiki page
https://jgromes.github.io/RadioLib/ https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library
@ -55,15 +59,15 @@ void setup() {
*/ */
} }
// counter to keep track of transmitted packets
int count = 0;
void loop() { void loop() {
Serial.print(F("[SX1278] Transmitting packet ... ")); Serial.print(F("[SX1278] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to // you can transmit C-string or Arduino string up to
// 255 characters long // 255 characters long
// NOTE: transmit() is a blocking method! int state = radio.transmit("Hello World! #" + String(count++));
// See example SX127x_Transmit_Interrupt for details
// on non-blocking transmission method.
int state = radio.transmit("Hello World!");
// you can also transmit byte array up to 256 bytes long // you can also transmit byte array up to 256 bytes long
/* /*

View file

@ -1,20 +1,20 @@
/* /*
RadioLib SX127x Transmit with Interrupts Example RadioLib SX127x Transmit with Interrupts Example
This example transmits LoRa packets with one second delays This example transmits LoRa packets with one second delays
between them. Each packet contains up to 255 bytes between them. Each packet contains up to 255 bytes
of data, in the form of: of data, in the form of:
- Arduino String - Arduino String
- null-terminated char array (C-string) - null-terminated char array (C-string)
- arbitrary binary data (byte array) - arbitrary binary data (byte array)
Other modules from SX127x/RFM9x family can also be used. Other modules from SX127x/RFM9x family can also be used.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library
@ -63,7 +63,7 @@ void setup() {
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF}; 0x89, 0xAB, 0xCD, 0xEF};
state = radio.startTransmit(byteArr, 8); transmissionState = radio.startTransmit(byteArr, 8);
*/ */
} }
@ -115,13 +115,13 @@ void loop() {
// you can transmit C-string or Arduino string up to // you can transmit C-string or Arduino string up to
// 255 characters long // 255 characters long
transmissionState = radio.startTransmit("Hello World!"); transmissionState = radio.startTransmit("Hello World! #" + String(count++));
// you can also transmit byte array up to 255 bytes long // you can also transmit byte array up to 255 bytes long
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF}; 0x89, 0xAB, 0xCD, 0xEF};
int state = radio.startTransmit(byteArr, 8); transmissionState = radio.startTransmit(byteArr, 8);
*/ */
} }
} }