Update Radiolib version to 7.1.0

This commit is contained in:
lewisxhe
2024-12-20 10:30:28 +08:00
parent ec34aea9f7
commit 7f7f0022fe
185 changed files with 5193 additions and 2116 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ jobs:
- name: Build example - name: Build example
run: run:
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX126x/SX126x_Transmit_Blocking/SX126x_Transmit_Blocking.ino --warnings=all arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX123x/SX123x_Transmit_Blocking/SX123x_Transmit_Blocking.ino --warnings=all
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@v3
+5 -11
View File
@@ -10,12 +10,11 @@ on:
id: id:
description: The ID of the platform on which the build is run description: The ID of the platform on which the build is run
required: true required: true
default: arduino:avr:uno default: arduino:avr:mega
type: choice type: choice
options: options:
- all - all
- none - none
- arduino:avr:uno
- arduino:avr:mega - arduino:avr:mega
- arduino:mbed:nano33ble - arduino:mbed:nano33ble
- arduino:mbed:envie_m4 - arduino:mbed:envie_m4
@@ -27,7 +26,6 @@ on:
- esp32:esp32:esp32 - esp32:esp32:esp32
- esp8266:esp8266:generic - esp8266:esp8266:generic
- Intel:arc32:arduino_101 - Intel:arc32:arduino_101
- SparkFun:apollo3:sfe_artemis
- STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC - STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1 - STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
- stm32duino:STM32F1:mapleMini - stm32duino:STM32F1:mapleMini
@@ -45,8 +43,6 @@ jobs:
matrix: matrix:
# platform-dependent settings - extra board options, board index URLs, skip patterns etc. # platform-dependent settings - extra board options, board index URLs, skip patterns etc.
include: include:
- id: arduino:avr:uno
run: echo "skip-pattern=(STM32WL|SSTV|LoRaWAN|LR11x0_Firmware_Update|Pager|APRS|Morse)" >> $GITHUB_OUTPUT
- id: arduino:avr:mega - id: arduino:avr:mega
run: | run: |
echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT
@@ -86,11 +82,6 @@ jobs:
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
echo "options=':xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K'" >> $GITHUB_OUTPUT echo "options=':xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K'" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT
- id: SparkFun:apollo3:sfe_artemis
run: |
echo "skip-pattern=(STM32WL|LoRaWAN)" >> $GITHUB_OUTPUT
echo "warnings='none'" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json" >> $GITHUB_OUTPUT
- id: STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC - id: STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
run: | run: |
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
@@ -131,9 +122,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: ${{ matrix.id }} name: ${{ matrix.id }}
env: env:
run-build: ${{ (inputs.id != 'none' && matrix.id == 'arduino:avr:uno') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.id)) || inputs.id == 'all' || inputs.id == matrix.id }} run-build: ${{ (inputs.id != 'none' && matrix.id == 'arduino:avr:mega') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.id)) || inputs.id == 'all' || inputs.id == matrix.id }}
steps: steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
- name: Install arduino-cli - name: Install arduino-cli
if: ${{ env.run-build == 'true' }} if: ${{ env.run-build == 'true' }}
run: run:
+1
View File
@@ -49,6 +49,7 @@ SX127x, RFM9x, SX126x, LR11x0 and SX128x
### Supported Arduino platforms: ### Supported Arduino platforms:
* __Arduino__ * __Arduino__
* [__AVR__](https://github.com/arduino/ArduinoCore-avr) - Arduino Uno, Mega, Leonardo, Pro Mini, Nano etc. * [__AVR__](https://github.com/arduino/ArduinoCore-avr) - Arduino Uno, Mega, Leonardo, Pro Mini, Nano etc.
* NOTE: Arduino boards based on ATmega328 (Uno, Pro Mini, Nano etc.) and smaller are NOT recommended. This is because the ATmega328 MCU is very constrained in terms of program and memory size, so the library will end up taking most of the space available.
* [__mbed__](https://github.com/arduino/ArduinoCore-mbed) - Arduino Nano 33 BLE and Arduino Portenta H7 * [__mbed__](https://github.com/arduino/ArduinoCore-mbed) - Arduino Nano 33 BLE and Arduino Portenta H7
* [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every * [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every
* [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due * [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due
@@ -1,19 +1,19 @@
/* /*
RadioLib AFSK External Radio example RadioLib AFSK External Radio example
This example shows how to use your Arduino This example shows how to use your Arduino
as modulator for an external analogue FM radio. as modulator for an external analogue FM radio.
The example sends APRS position reports with The example sends APRS position reports with
audio modulated as AFSK at 1200 baud using audio modulated as AFSK at 1200 baud using
Bell 202 tones. However, any other AFSK Bell 202 tones. However, any other AFSK
protocol (RTTY, SSTV, etc.) may be used as well. protocol (RTTY, SSTV, etc.) may be used as well.
DO NOT transmit in APRS bands unless DO NOT transmit in APRS bands unless
you have a ham radio license! you have a ham radio license!
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
@@ -1,21 +1,21 @@
/* /*
RadioLib AFSK Imperial March Example RadioLib AFSK Imperial March Example
This example shows how to EXECUTE ORDER 66 This example shows how to EXECUTE ORDER 66
Other modules that can be used for AFSK: Other modules that can be used for AFSK:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -1,7 +1,7 @@
/* /*
Note definitions, melody and melody-related functions Note definitions, melody and melody-related functions
adapted from https://github.com/robsoncouto/arduino-songs adapted from https://github.com/robsoncouto/arduino-songs
by Robson Couto, 2019 by Robson Couto, 2019
*/ */
#define NOTE_B0 31 #define NOTE_B0 31
@@ -1,22 +1,22 @@
/* /*
RadioLib AFSK Example RadioLib AFSK Example
This example shows hot to send audio FSK tones This example shows hot to send audio FSK tones
using SX1278's FSK modem. using SX1278's FSK modem.
Other modules that can be used for AFSK: Other modules that can be used for AFSK:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -1,20 +1,20 @@
/* /*
RadioLib AM-modulated AFSK Example RadioLib AM-modulated AFSK Example
This example shows hot to send AM-modulated This example shows hot to send AM-modulated
audio FSK tones using SX1278's OOK modem. audio FSK tones using SX1278's OOK modem.
Other modules that can be used for AFSK: Other modules that can be used for AFSK:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -1,28 +1,28 @@
/* /*
RadioLib APRS Mic-E Example RadioLib APRS Mic-E Example
This example sends APRS position reports This example sends APRS position reports
encoded in the Mic-E format using SX1278's encoded in the Mic-E format using SX1278's
FSK modem. The data is modulated as AFSK FSK modem. The data is modulated as AFSK
at 1200 baud using Bell 202 tones. at 1200 baud using Bell 202 tones.
DO NOT transmit in APRS bands unless DO NOT transmit in APRS bands unless
you have a ham radio license! you have a ham radio license!
Other modules that can be used for APRS: Other modules that can be used for APRS:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -35,9 +35,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct
@@ -1,28 +1,28 @@
/* /*
RadioLib APRS Position Example RadioLib APRS Position Example
This example sends APRS position reports This example sends APRS position reports
using SX1278's FSK modem. The data is using SX1278's FSK modem. The data is
modulated as AFSK at 1200 baud using Bell modulated as AFSK at 1200 baud using Bell
202 tones. 202 tones.
DO NOT transmit in APRS bands unless DO NOT transmit in APRS bands unless
you have a ham radio license! you have a ham radio license!
Other modules that can be used for APRS: Other modules that can be used for APRS:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -35,9 +35,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct
@@ -105,32 +109,49 @@ void setup() {
} }
void loop() { void loop() {
Serial.print(F("[APRS] Sending position ... ")); Serial.println(F("[APRS] Sending location reports"));
// send a location without message or timestamp // send a location without message or timestamp
char destination[] = "N0CALL"; char destination[] = "N0CALL";
char latitude[] = "4911.67N"; char latitude[] = "4911.67N";
char longitude[] = "01635.96E"; char longitude[] = "01635.96E";
int state = aprs.sendPosition(destination, 0, latitude, longitude); int state = aprs.sendPosition(destination, 0, latitude, longitude);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("[APRS] Failed to send location, code "));
Serial.println(state);
}
delay(500); delay(500);
// send a location with message and without timestamp // send a location with message and without timestamp
char message[] = "I'm here!"; char message[] = "I'm here!";
state |= aprs.sendPosition(destination, 0, latitude, longitude, message); state = aprs.sendPosition(destination, 0, latitude, longitude, message);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("[APRS] Failed to send location and message code "));
Serial.println(state);
}
delay(500); delay(500);
// you can also set repeater callsigns and SSIDs
// up to 8 repeaters may be used
// sendPosition will be sent with "WIDE2-2" path
char* repeaterCallsigns[] = { "WIDE2" };
uint8_t repeaterSSIDs[] = { 2 };
aprs.useRepeaters(repeaterCallsigns, repeaterSSIDs, 1);
// send a location with message and timestamp // send a location with message and timestamp
char timestamp[] = "093045z"; char timestamp[] = "093045z";
state |= aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp); state = aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp);
delay(500); if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("[APRS] Failed to send location, message and timestamp code "));
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state); Serial.println(state);
} }
delay(500);
// when repeaters are no longer needed, they can be dropped
aprs.dropRepeaters();
// wait one minute before transmitting again // wait one minute before transmitting again
Serial.println(F("[APRS] All done!"));
delay(60000); delay(60000);
} }
@@ -1,20 +1,20 @@
/* /*
RadioLib APRS Position over LoRa Example RadioLib APRS Position over LoRa Example
This example sends APRS position reports This example sends APRS position reports
using SX1278's LoRa modem. using SX1278's LoRa modem.
Other modules that can be used for APRS: Other modules that can be used for APRS:
- SX127x/RFM9x - SX127x/RFM9x
- SX126x/LLCC68 - SX126x/LLCC68
- SX128x - SX128x
- LR11x0 - LR11x0
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -27,9 +27,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create APRS client instance using the LoRa radio // create APRS client instance using the LoRa radio
APRSClient aprs(&radio); APRSClient aprs(&radio);
@@ -1,31 +1,31 @@
/* /*
RadioLib AX.25 Frame Example RadioLib AX.25 Frame Example
This example shows how to send various This example shows how to send various
AX.25 frames using SX1278's FSK modem. AX.25 frames using SX1278's FSK modem.
Other modules that can be used for AX.25: Other modules that can be used for AX.25:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- SX126x - SX126x
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- LR11x0 - LR11x0
Using raw AX.25 frames requires some Using raw AX.25 frames requires some
knowledge of the protocol, refer to knowledge of the protocol, refer to
AX25_Transmit for basic operation. AX25_Transmit for basic operation.
Frames shown in this example are not Frames shown in this example are not
exhaustive; all possible AX.25 frames exhaustive; all possible AX.25 frames
should be supported. should be supported.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -38,9 +38,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AX.25 client instance using the FSK module // create AX.25 client instance using the FSK module
AX25Client ax25(&radio); AX25Client ax25(&radio);
@@ -1,24 +1,24 @@
/* /*
RadioLib AX.25 Transmit Example RadioLib AX.25 Transmit Example
This example sends AX.25 messages using This example sends AX.25 messages using
SX1278's FSK modem. SX1278's FSK modem.
Other modules that can be used for AX.25: Other modules that can be used for AX.25:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- SX126x - SX126x
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- LR11x0 - LR11x0
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AX.25 client instance using the FSK module // create AX.25 client instance using the FSK module
AX25Client ax25(&radio); AX25Client ax25(&radio);
@@ -1,25 +1,25 @@
/* /*
RadioLib AX.25 Transmit AFSK Example RadioLib AX.25 Transmit AFSK Example
This example sends AX.25 messages using This example sends AX.25 messages using
SX1278's FSK modem. The data is modulated SX1278's FSK modem. The data is modulated
as AFSK at 1200 baud using Bell 202 tones. as AFSK at 1200 baud using Bell 202 tones.
Other modules that can be used for AX.25 Other modules that can be used for AX.25
with AFSK modulation: with AFSK modulation:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -32,9 +32,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct
@@ -1,18 +1,18 @@
/* /*
RadioLib Bell Modem Transmit Example RadioLib Bell Modem Transmit Example
This example shows how to transmit binary data This example shows how to transmit binary data
using audio Bell 202 tones. using audio Bell 202 tones.
Other implemented Bell modems Other implemented Bell modems
- Bell 101 - Bell 101
- Bell 103 - Bell 103
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -1,17 +1,17 @@
/* /*
RadioLib CC1101 Receive with Address Example RadioLib CC1101 Receive with Address Example
This example receives packets using CC1101 FSK radio This example receives packets using CC1101 FSK radio
module. Packets can have 1-byte address of the module. Packets can have 1-byte address of the
destination node. After setting node address, this node destination node. After setting node address, this node
will automatically filter out any packets that do not will automatically filter out any packets that do not
contain either node address or broadcast addresses. contain either node address or broadcast addresses.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101 https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
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
@@ -24,9 +24,13 @@
// GDO2 pin: 3 (optional) // GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -31,9 +31,13 @@
// GDO2 pin: 3 (optional) // GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,22 +1,22 @@
/* /*
RadioLib CC1101 Receive with Interrupts Example RadioLib CC1101 Receive with Interrupts Example
This example listens for FSK transmissions and tries to This example listens for FSK transmissions and tries to
receive them. Once a packet is received, an interrupt is receive them. Once a packet is received, an interrupt is
triggered. triggered.
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
- bit rate - bit rate
- frequency deviation - frequency deviation
- sync word - sync word
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101 https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
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
@@ -29,9 +29,13 @@
// GDO2 pin: 3 (optional) // GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,21 +1,21 @@
/* /*
RadioLib CC1101 Settings Example RadioLib CC1101 Settings Example
This example shows how to change all the properties of RF69 radio. This example shows how to change all the properties of RF69 radio.
RadioLib currently supports the following settings: RadioLib currently supports the following settings:
- pins (SPI slave select, digital IO 0, digital IO 1) - pins (SPI slave select, digital IO 0, digital IO 1)
- carrier frequency - carrier frequency
- bit rate - bit rate
- receiver bandwidth - receiver bandwidth
- allowed frequency deviation - allowed frequency deviation
- output power during transmission - output power during transmission
- sync word - sync word
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101 https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
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
@@ -35,9 +35,13 @@ CC1101 radio1 = new Module(10, 2, RADIOLIB_NC, 3);
// GDO2 pin: 5 (optional) // GDO2 pin: 5 (optional)
CC1101 radio2 = new Module(9, 4, RADIOLIB_NC, 5); CC1101 radio2 = new Module(9, 4, RADIOLIB_NC, 5);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio3 = RadioShield.ModuleB; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio3 = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,17 +1,17 @@
/* /*
RadioLib CC1101 Transmit to Address Example RadioLib CC1101 Transmit to Address Example
This example transmits packets using CC1101 FSK radio This example transmits packets using CC1101 FSK radio
module. Packets can have 1-byte address of the module. Packets can have 1-byte address of the
destination node. After setting node address, this node destination node. After setting node address, this node
will automatically filter out any packets that do not will automatically filter out any packets that do not
contain either node address or broadcast addresses. contain either node address or broadcast addresses.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101 https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
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
@@ -24,9 +24,13 @@
// GDO2 pin: 3 (optional) // GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -28,9 +28,13 @@
// GDO2 pin: 3 // GDO2 pin: 3
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,18 +1,18 @@
/* /*
RadioLib CC1101 Transmit with Interrupts Example RadioLib CC1101 Transmit with Interrupts Example
This example transmits packets using CC1101 FSK radio module. This example transmits packets using CC1101 FSK radio module.
Once a packet is transmitted, an interrupt is triggered. Once a packet is transmitted, an interrupt is triggered.
Each packet contains up to 64 bytes of data, in the form of: Each packet contains up to 64 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)
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101 https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
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
@@ -25,9 +25,13 @@
// GDO2 pin: 3 // GDO2 pin: 3
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
@@ -1,27 +1,27 @@
/* /*
RadioLib FSK4 Transmit Example RadioLib FSK4 Transmit Example
This example sends an example FSK-4 'Horus Binary' message This example sends an example FSK-4 'Horus Binary' message
using SX1278's FSK modem. using SX1278's FSK modem.
This signal can be demodulated using a SSB demodulator (SDR or otherwise), This signal can be demodulated using a SSB demodulator (SDR or otherwise),
and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
Other modules that can be used for FSK4: Other modules that can be used for FSK4:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- SX126x - SX126x
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- SX128x - SX128x
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -34,9 +34,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create FSK4 client instance using the FSK module // create FSK4 client instance using the FSK module
FSK4Client fsk4(&radio); FSK4Client fsk4(&radio);
@@ -1,25 +1,25 @@
/* /*
RadioLib FSK4 Transmit AFSK Example RadioLib FSK4 Transmit AFSK Example
This example sends an example FSK-4 'Horus Binary' message This example sends an example FSK-4 'Horus Binary' message
using SX1278's FSK modem. The data is modulated as AFSK. using SX1278's FSK modem. The data is modulated as AFSK.
This signal can be demodulated using an FM demodulator (SDR or otherwise), This signal can be demodulated using an FM demodulator (SDR or otherwise),
and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
Other modules that can be used for FSK4: Other modules that can be used for FSK4:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -32,9 +32,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct
@@ -1,25 +1,25 @@
/* /*
RadioLib Hellschreiber Transmit Example RadioLib Hellschreiber Transmit Example
This example sends Hellschreiber message using This example sends Hellschreiber message using
SX1278's FSK modem. SX1278's FSK modem.
Other modules that can be used for Hellschreiber: Other modules that can be used for Hellschreiber:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- SX126x - SX126x
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- SX128x - SX128x
- LR11x0 - LR11x0
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -32,9 +32,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create Hellschreiber client instance using the FSK module // create Hellschreiber client instance using the FSK module
HellClient hell(&radio); HellClient hell(&radio);
@@ -1,24 +1,24 @@
/* /*
RadioLib Hellschreiber Transmit AFSK Example RadioLib Hellschreiber Transmit AFSK Example
This example sends Hellschreiber message using This example sends Hellschreiber message using
SX1278's FSK modem. The data is modulated SX1278's FSK modem. The data is modulated
as AFSK. as AFSK.
Other modules that can be used for Hellschreiber Other modules that can be used for Hellschreiber
with AFSK modulation: with AFSK modulation:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct
@@ -34,6 +34,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@@ -57,10 +65,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@@ -71,6 +75,9 @@ void setup() {
Serial.println(state); Serial.println(state);
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
} }
void loop() { void loop() {
@@ -29,6 +29,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@@ -52,10 +60,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@@ -67,6 +71,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when LoRa packet or timeout is detected // when LoRa packet or timeout is detected
radio.setIrqAction(setFlag); radio.setIrqAction(setFlag);
@@ -48,9 +48,13 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//LR1110 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -26,9 +26,13 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//LR1110 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -0,0 +1,182 @@
/*
RadioLib LR11x0 GNSS Almanac Update Example
This example updates the LR11x0 GNSS almanac.
Almanac is a database of orbital predictions of
GNSS satellites, which allows the module to predict
when different satellites will appear in the sky,
and frequency of their signal.
Up-to-date almanac is necessary for operation!
After an update, data will remain valid for 30 days.
All GNSS examples require at least limited
visibility of the sky!
NOTE: This example will only work for LR11x0 devices
with sufficiently recent firmware!
LR1110: 4.1
LR1120: 2.1
If your device firmware reports older firmware,
update it using the LR11x0_Firmware_Update example.
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// LR1110 has the following connections:
// NSS pin: 10
// DIO1 pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
// structure to save information about the GNSS almanac
LR11x0GnssAlmanacStatus_t almStatus;
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.beginGNSS(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// check the firmware version
Serial.print(F("[LR1110] Checking firmware version ... "));
state = radio.isGnssScanCapable();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("check passed!"));
} else {
Serial.println(F("check failed, firmware update needed."));
while (true) { delay(10); }
}
// run GNSS scans until we get at least the time
// NOTE: Depending on visibility of satellites,
// this may take multiple attempts!
while(true) {
// run GNSS scan
Serial.print(F("[LR1110] Running GNSS scan ... "));
state = radio.gnssScan(NULL);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// check almanac status
Serial.print(F("[LR1110] Checking GNSS almanac ... "));
state = radio.getGnssAlmanacStatus(&almStatus);
if (state != RADIOLIB_ERR_NONE) {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// we have the status, check if we have demodulated time
if(almStatus.gps.status < RADIOLIB_LR11X0_GNSS_ALMANAC_STATUS_UP_TO_DATE) {
Serial.println(F("time unknown, another scan needed."));
} else if(almStatus.gps.numUpdateNeeded > 0) {
Serial.print(almStatus.gps.numUpdateNeeded);
Serial.println(F(" satellites out-of-date."));
break;
} else {
Serial.println(F("no update needed!"));
while (true) { delay(10); }
}
}
}
void loop() {
// wait until almanac data is available in the signal
// multiple attempts are needed for this
Serial.print(F("[LR1110] Waiting for subframe ... "));
int state = radio.gnssDelayUntilSubframe(&almStatus, RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
if(state == RADIOLIB_ERR_GNSS_SUBFRAME_NOT_AVAILABLE) {
Serial.println(F("not enough time left."));
// wait until the next update window
delay(2000);
} else {
Serial.println(F("done!"));
// we have enough time to start the update
Serial.print(F("[LR1110] Starting update ... "));
state = radio.updateGnssAlmanac(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("failed, code "));
Serial.println(state);
} else {
Serial.println(F("done!"));
}
}
// check whether another update is needed
Serial.print(F("[LR1110] Checking GNSS almanac ... "));
state = radio.getGnssAlmanacStatus(&almStatus);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// check if we have completed the update
if(almStatus.gps.numUpdateNeeded == 0) {
Serial.println(F("all satellites up-to-date!"));
while (true) { delay(10); }
} else {
Serial.print(almStatus.gps.numUpdateNeeded);
Serial.println(F(" satellites out-of-date."));
}
// wait a bit before the next update attempt
delay(1000);
}
@@ -0,0 +1,134 @@
/*
RadioLib LR11x0 GNSS Autonomous Position Example
This example performs GNSS scans and calculates
position of the device using autonomous mode.
In this mode, scan data does not need to be uploaded
to LoRaCloud, however, it requires up-to-date almanac
data. Run the LR11x0_Almanac_Update example to update
the device almanac.
NOTE: This example will only work for LR11x0 devices
with sufficiently recent firmware!
LR1110: 4.1
LR1120: 2.1
If your device firmware reports older firmware,
update it using the LR11x0_Firmware_Update example.
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// LR1110 has the following connections:
// NSS pin: 10
// DIO1 pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
// structure to save information about the GNSS scan result
LR11x0GnssResult_t gnssResult;
// structure to save information about the calculated GNSS position
LR11x0GnssPosition_t gnssPosition;
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.beginGNSS(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// check the firmware version
Serial.print(F("[LR1110] Checking firmware version ... "));
state = radio.isGnssScanCapable();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("check passed!"));
} else {
Serial.println(F("check failed, firmware update needed."));
while (true) { delay(10); }
}
Serial.println(F("Scan result\t| Latitude\t| Longitude\t| Accuracy\t| Number of satellites"));
}
void loop() {
// run GNSS scan
int state = radio.gnssScan(&gnssResult);
if(state == RADIOLIB_ERR_NONE) {
// success!
Serial.print(gnssResult.demodStat); Serial.print("\t\t| ");
// get the actual data
state = radio.getGnssPosition(&gnssPosition);
if(state == RADIOLIB_ERR_NONE) {
// print the position
Serial.print(gnssPosition.latitude, 6);
Serial.print("\t| ");
Serial.print(gnssPosition.longitude, 6);
Serial.print("\t| ");
Serial.print(gnssPosition.accuracy);
Serial.print("\t\t| ");
Serial.println(gnssPosition.numSatsUsed);
} else {
Serial.print(F("Failed to read result, code "));
Serial.print(state);
Serial.print(F(" (solver error "));
Serial.print(RADIOLIB_GET_GNSS_SOLVER_ERROR(state));
Serial.println(F(")"));
}
} else {
Serial.print(F("Scan failed, code "));
Serial.print(state);
Serial.print(F(" (demodulator error "));
Serial.print(RADIOLIB_GET_GNSS_DEMOD_ERROR(state));
Serial.println(F(")"));
}
// wait a bit before the next scan
delay(1000);
}
@@ -0,0 +1,133 @@
/*
RadioLib LR11x0 GNSS Satellites Example
This example performs GNSS scans and shows the satellites
currently in view. It is mostly useful to verify
visibility and antenna setup.
NOTE: This example will only work for LR11x0 devices
with sufficiently recent firmware!
LR1110: 4.1
LR1120: 2.1
If your device firmware reports older firmware,
update it using the LR11x0_Firmware_Update example.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---wifi-scan
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// LR1110 has the following connections:
// NSS pin: 10
// DIO1 pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
// structure to save information about the GNSS scan result
LR11x0GnssResult_t gnssResult;
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.beginGNSS(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// check the firmware version
Serial.print(F("[LR1110] Checking firmware version ... "));
state = radio.isGnssScanCapable();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("check passed!"));
} else {
Serial.println(F("check failed, firmware update needed."));
while (true) { delay(10); }
}
}
void loop() {
Serial.print(F("[LR1110] Running GNSS scan ... "));
int state = radio.gnssScan(&gnssResult);
if(state != RADIOLIB_ERR_NONE) {
// some error occurred
Serial.print(F("failed, code "));
Serial.print(state);
Serial.print(F(" (demodulator error "));
Serial.print(RADIOLIB_GET_GNSS_DEMOD_ERROR(state));
Serial.println(F(")"));
} else {
Serial.println(F("success!"));
// print the table header
Serial.print(F("[LR1110] Detected "));
Serial.print(gnssResult.numSatsDet);
Serial.println(F(" satellite(s):"));
Serial.println(F(" # | ID | C/N0 [dB]\t| Doppler [Hz]"));
// read all results at once
LR11x0GnssSatellite_t satellites[32];
state = radio.getGnssSatellites(satellites, gnssResult.numSatsDet);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("Failed to read results, code "));
Serial.println(state);
} else {
// print all the results
for(int i = 0; i < gnssResult.numSatsDet; i++) {
if(i < 10) { Serial.print(" "); } Serial.print(i); Serial.print(" | ");
Serial.print(satellites[i].svId); Serial.print(" | ");
Serial.print(satellites[i].c_n0); Serial.print("\t\t| ");
Serial.println(satellites[i].doppler);
}
}
}
// wait for a second before scanning again
delay(1000);
}
@@ -2,6 +2,7 @@
RadioLib LR11x0 LR-FHSS Modem Example RadioLib LR11x0 LR-FHSS Modem Example
This example shows how to use LR-FHSS modem in LR11x0 chips. This example shows how to use LR-FHSS modem in LR11x0 chips.
This modem can only transmit data, and is not able to receive.
NOTE: The sketch below is just a guide on how to use NOTE: The sketch below is just a guide on how to use
LR-FHSS modem, so this code should not be run directly! LR-FHSS modem, so this code should not be run directly!
@@ -26,9 +27,13 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//LR1110 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -68,9 +73,7 @@ void setup() {
} }
void loop() { void loop() {
// LR-FHSS modem can use the same transmit/receive methods // LR-FHSS modem can only transmit!
// as the LoRa modem, even their interrupt-driven versions
// transmit LR-FHSS packet // transmit LR-FHSS packet
int state = radio.transmit("Hello World!"); int state = radio.transmit("Hello World!");
/* /*
@@ -89,22 +92,4 @@ void loop() {
Serial.println(state); Serial.println(state);
} }
// receive LR-FHSS packet
String str;
state = radio.receive(str);
/*
byte byteArr[8];
int state = radio.receive(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("[LR1110] Received packet!"));
Serial.print(F("[LR1110] Data:\t"));
Serial.println(str);
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
Serial.println(F("[LR1110] Timed out while waiting for packet!"));
} else {
Serial.print(F("[LR1110] Failed to receive packet, code "));
Serial.println(state);
}
} }
@@ -22,6 +22,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@@ -66,10 +74,6 @@ void setFlag(void) {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@@ -81,6 +85,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when new packet is received // when new packet is received
radio.setIrqAction(setFlag); radio.setIrqAction(setFlag);
@@ -39,6 +39,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@@ -62,10 +70,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@@ -76,6 +80,9 @@ void setup() {
Serial.println(state); Serial.println(state);
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
} }
void loop() { void loop() {
@@ -35,6 +35,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@@ -58,10 +66,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@@ -73,6 +77,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when new packet is received // when new packet is received
radio.setPacketReceivedAction(setFlag); radio.setPacketReceivedAction(setFlag);
@@ -30,6 +30,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@@ -53,10 +61,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@@ -68,6 +72,9 @@ void setup() {
delay(1000); delay(1000);
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
} }
// counter to keep track of transmitted packets // counter to keep track of transmitted packets
@@ -31,6 +31,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@@ -57,10 +65,6 @@ int transmissionState = RADIOLIB_ERR_NONE;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@@ -72,6 +76,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when packet transmission is finished // when packet transmission is finished
radio.setPacketSentAction(setFlag); radio.setPacketSentAction(setFlag);
@@ -32,6 +32,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@@ -55,10 +63,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@@ -69,6 +73,9 @@ void setup() {
Serial.println(state); Serial.println(state);
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
} }
void loop() { void loop() {
@@ -32,6 +32,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@@ -55,10 +63,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@@ -70,6 +74,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when WiFi scan is complete // when WiFi scan is complete
radio.setIrqAction(setFlag); radio.setIrqAction(setFlag);
@@ -1,23 +1,23 @@
/* /*
RadioLib SX127x Morse Receive AM Example RadioLib SX127x Morse Receive AM Example
This example receives Morse code message using This example receives Morse code message using
SX1278's FSK modem. The signal is expected to be SX1278's FSK modem. The signal is expected to be
modulated as OOK, to be demodulated in AM mode. modulated as OOK, to be demodulated in AM mode.
Other modules that can be used for Morse Code Other modules that can be used for Morse Code
with AFSK modulation: with AFSK modulation:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -30,9 +30,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2 // pin 5 is connected to SX1278 DIO2
@@ -1,23 +1,23 @@
/* /*
RadioLib Morse Transmit AM Example RadioLib Morse Transmit AM Example
This example sends Morse code message using This example sends Morse code message using
SX1278's FSK modem. The signal is modulated SX1278's FSK modem. The signal is modulated
as OOK, and may be demodulated in AM mode. as OOK, and may be demodulated in AM mode.
Other modules that can be used for Morse Code Other modules that can be used for Morse Code
with AM modulation: with AM modulation:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -30,9 +30,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2 // pin 5 is connected to SX1278 DIO2
@@ -1,24 +1,24 @@
/* /*
RadioLib Morse Transmit AFSK Example RadioLib Morse Transmit AFSK Example
This example sends Morse code message using This example sends Morse code message using
SX1278's FSK modem. The signal is modulated SX1278's FSK modem. The signal is modulated
as AFSK, and may be demodulated in FM mode. as AFSK, and may be demodulated in FM mode.
Other modules that can be used for Morse Code Other modules that can be used for Morse Code
with AFSK modulation: with AFSK modulation:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct
@@ -1,26 +1,26 @@
/* /*
RadioLib Morse Transmit SSB Example RadioLib Morse Transmit SSB Example
This example sends Morse code message using This example sends Morse code message using
SX1278's FSK modem. The signal is an unmodulated SX1278's FSK modem. The signal is an unmodulated
carrier wave, and may be demodulated in SSB mode. carrier wave, and may be demodulated in SSB mode.
Other modules that can be used for Morse Code: Other modules that can be used for Morse Code:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- SX126x - SX126x
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- SX128x - SX128x
- LR11x0 - LR11x0
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -33,9 +33,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create Morse client instance using the FSK module // create Morse client instance using the FSK module
MorseClient morse(&radio); MorseClient morse(&radio);
@@ -17,7 +17,7 @@
#include <RadioLib.h> #include <RadioLib.h>
// include the hardware abstraction layer // include the hardware abstraction layer
#include "EspHal.h" #include "hal/ESP-IDF/EspHal.h"
// create a new instance of the HAL class // create a new instance of the HAL class
EspHal* hal = new EspHal(5, 19, 27); EspHal* hal = new EspHal(5, 19, 27);
@@ -23,11 +23,11 @@ add_executable(${PROJECT_NAME}
) )
# Pull in common dependencies # Pull in common dependencies
target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi hardware_gpio hardware_timer RadioLib) target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi hardware_gpio hardware_timer pico_multicore hardware_pwm RadioLib)
pico_enable_stdio_usb(${PROJECT_NAME} 1) pico_enable_stdio_usb(${PROJECT_NAME} 1)
pico_enable_stdio_uart(${PROJECT_NAME} 0) pico_enable_stdio_uart(${PROJECT_NAME} 0)
# Create map/bin/hex file etc. # Create map/bin/hex file etc.
pico_add_extra_outputs(${PROJECT_NAME}) pico_add_extra_outputs(${PROJECT_NAME})
@@ -41,7 +41,7 @@
#include <RadioLib.h> #include <RadioLib.h>
// include the hardware abstraction layer // include the hardware abstraction layer
#include "PicoHal.h" #include "hal/RPiPico/PicoHal.h"
// create a new instance of the HAL class // create a new instance of the HAL class
PicoHal* hal = new PicoHal(SPI_PORT, SPI_MISO, SPI_MOSI, SPI_SCK); PicoHal* hal = new PicoHal(SPI_PORT, SPI_MISO, SPI_MOSI, SPI_SCK);
@@ -18,7 +18,7 @@
#include <RadioLib.h> #include <RadioLib.h>
// include the hardware abstraction layer // include the hardware abstraction layer
#include "PiHal.h" #include "hal/RPi/PiHal.h"
// create a new instance of the HAL class // create a new instance of the HAL class
// use SPI channel 1, because on Waveshare LoRaWAN Hat, // use SPI channel 1, because on Waveshare LoRaWAN Hat,
@@ -28,7 +28,7 @@
#include <RadioLib.h> #include <RadioLib.h>
// include the hardware abstraction layer // include the hardware abstraction layer
#include "libtockHal.h" #include "hal/Tock/libtockHal.h"
// the entry point for the program // the entry point for the program
int main(void) { int main(void) {
@@ -1,24 +1,24 @@
/* /*
RadioLib Pager (POCSAG) Receive Example RadioLib Pager (POCSAG) Receive Example
This example shows how to receive FSK packets without using This example shows how to receive FSK packets without using
SX127x packet engine. SX127x packet engine.
This example receives POCSAG messages using SX1278's This example receives POCSAG messages using SX1278's
FSK modem in direct mode. FSK modem in direct mode.
Other modules that can be used to receive POCSAG: Other modules that can be used to receive POCSAG:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
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
@@ -45,9 +45,13 @@ const int pin = 5;
// create Pager client instance using the FSK module // create Pager client instance using the FSK module
PagerClient pager(&radio); PagerClient pager(&radio);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,24 +1,24 @@
/* /*
RadioLib Pager (POCSAG) Transmit Example RadioLib Pager (POCSAG) Transmit Example
This example sends POCSAG messages using SX1278's This example sends POCSAG messages using SX1278's
FSK modem. FSK modem.
Other modules that can be used to send POCSAG: Other modules that can be used to send POCSAG:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- SX126x - SX126x
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- SX128x - SX128x
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create Pager client instance using the FSK module // create Pager client instance using the FSK module
PagerClient pager(&radio); PagerClient pager(&radio);
@@ -1,12 +1,12 @@
/* /*
RadioLib PhysicalLayer Interface Example RadioLib PhysicalLayer Interface Example
This example shows how to use the common PhysicalLayer This example shows how to use the common PhysicalLayer
to interface with different radio modules using the same to interface with different radio modules using the same
methods. methods.
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
@@ -23,6 +23,14 @@
// extra GPIO/interrupt pin: 3 (unused on some modules) // extra GPIO/interrupt pin: 3 (unused on some modules)
RADIO_TYPE radio = new Module(10, 2, 9, 3); RADIO_TYPE radio = new Module(10, 2, 9, 3);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// get pointer to the common layer // get pointer to the common layer
PhysicalLayer* phy = (PhysicalLayer*)&radio; PhysicalLayer* phy = (PhysicalLayer*)&radio;
@@ -1,15 +1,15 @@
/* /*
RadioLib RF69 Receive with AES Example RadioLib RF69 Receive with AES Example
This example receives packets using RF69 FSK radio module. This example receives packets using RF69 FSK radio module.
Packets are decrypted using hardware AES. Packets are decrypted using hardware AES.
NOTE: When using address filtering, the address byte is NOT encrypted! NOTE: When using address filtering, the address byte is NOT encrypted!
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
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
@@ -21,9 +21,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,17 +1,17 @@
/* /*
RadioLib RF69 Receive with Address Example RadioLib RF69 Receive with Address Example
This example receives packets using RF69 FSK radio module. This example receives packets using RF69 FSK radio module.
Packets can have 1-byte address of the destination node. Packets can have 1-byte address of the destination node.
After setting node (or broadcast) address, this node will After setting node (or broadcast) address, this node will
automatically filter out any packets that do not contain automatically filter out any packets that do not contain
either node address or broadcast address. either node address or broadcast address.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
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
@@ -23,9 +23,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -30,9 +30,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,15 +1,15 @@
/* /*
RadioLib RF69 Receive with Interrupts Example RadioLib RF69 Receive with Interrupts Example
This example listens for FSK transmissions and tries to This example listens for FSK transmissions and tries to
receive them. Once a packet is received, an interrupt is receive them. Once a packet is received, an interrupt is
triggered. triggered.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
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
@@ -21,9 +21,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,21 +1,21 @@
/* /*
RadioLib RF69 Settings Example RadioLib RF69 Settings Example
This example shows how to change all the properties of RF69 radio. This example shows how to change all the properties of RF69 radio.
RadioLib currently supports the following settings: RadioLib currently supports the following settings:
- pins (SPI slave select, digital IO 0, digital IO 1) - pins (SPI slave select, digital IO 0, digital IO 1)
- carrier frequency - carrier frequency
- bit rate - bit rate
- receiver bandwidth - receiver bandwidth
- allowed frequency deviation - allowed frequency deviation
- output power during transmission - output power during transmission
- sync word - sync word
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
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
@@ -33,9 +33,13 @@ RF69 radio1 = new Module(10, 2, 3);
// RESET pin: 5 // RESET pin: 5
RF69 radio2 = new Module(9, 4, 5); RF69 radio2 = new Module(9, 4, 5);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio3 = RadioShield.ModuleB; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio3 = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,15 +1,15 @@
/* /*
RadioLib RF69 Transmit with AES Example RadioLib RF69 Transmit with AES Example
This example transmits packets using RF69 FSK radio module. This example transmits packets using RF69 FSK radio module.
Packets are encrypted using hardware AES. Packets are encrypted using hardware AES.
NOTE: When using address filtering, the address byte is NOT encrypted! NOTE: When using address filtering, the address byte is NOT encrypted!
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
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
@@ -21,9 +21,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,17 +1,17 @@
/* /*
RadioLib RF69 Transmit to Address Example RadioLib RF69 Transmit to Address Example
This example transmits packets using RF69 FSK radio module. This example transmits packets using RF69 FSK radio module.
Packets can have 1-byte address of the destination node. Packets can have 1-byte address of the destination node.
After setting node (or broadcast) address, this node will After setting node (or broadcast) address, this node will
automatically filter out any packets that do not contain automatically filter out any packets that do not contain
either node address or broadcast address. either node address or broadcast address.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
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
@@ -23,9 +23,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -27,9 +27,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,18 +1,18 @@
/* /*
RadioLib RF69 Transmit with Interrupts Example RadioLib RF69 Transmit with Interrupts Example
This example transmits FSK packets with one second delays This example transmits FSK packets with one second delays
between them. Each packet contains up to 64 bytes between them. Each packet contains up to 64 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)
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231 https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
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
@@ -24,9 +24,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
@@ -1,25 +1,25 @@
/* /*
RadioLib RTTY Transmit Example RadioLib RTTY Transmit Example
This example sends RTTY message using SX1278's This example sends RTTY message using SX1278's
FSK modem. FSK modem.
Other modules that can be used for RTTY: Other modules that can be used for RTTY:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- SX126x - SX126x
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- SX128x - SX128x
- LR11x0 - LR11x0
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -32,9 +32,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create RTTY client instance using the FSK module // create RTTY client instance using the FSK module
RTTYClient rtty(&radio); RTTYClient rtty(&radio);
@@ -1,22 +1,22 @@
/* /*
RadioLib RTTY Transmit AFSK Example RadioLib RTTY Transmit AFSK Example
This example sends RTTY message using SX1278's This example sends RTTY message using SX1278's
FSK modem. The data is modulated as AFSK. FSK modem. The data is modulated as AFSK.
Other modules that can be used for RTTY: Other modules that can be used for RTTY:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -29,9 +29,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct
@@ -1,35 +1,35 @@
/* /*
RadioLib SSTV Transmit Example RadioLib SSTV Transmit Example
The following example sends SSTV picture using The following example sends SSTV picture using
SX1278's FSK modem. SX1278's FSK modem.
Other modules that can be used for SSTV: Other modules that can be used for SSTV:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- SX126x - SX126x
NOTE: SSTV is an analog modulation, and NOTE: SSTV is an analog modulation, and
requires precise frequency control. requires precise frequency control.
Some of the above modules can only Some of the above modules can only
set their frequency in rough steps, set their frequency in rough steps,
so the result can be distorted. so the result can be distorted.
Using high-precision radio with TCXO Using high-precision radio with TCXO
(like SX126x) is recommended. (like SX126x) is recommended.
NOTE: Some platforms (such as Arduino Uno) NOTE: Some platforms (such as Arduino Uno)
might not be fast enough to correctly might not be fast enough to correctly
send pictures via high-speed modes send pictures via high-speed modes
like Scottie2 or Martin2. For those, like Scottie2 or Martin2. For those,
lower speed modes such as Wrasse, lower speed modes such as Wrasse,
Scottie1 or Martin1 are recommended. Scottie1 or Martin1 are recommended.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -42,9 +42,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create SSTV client instance using the FSK module // create SSTV client instance using the FSK module
SSTVClient sstv(&radio); SSTVClient sstv(&radio);
@@ -1,31 +1,31 @@
/* /*
RadioLib SSTV Transmit AFSK Example RadioLib SSTV Transmit AFSK Example
The following example sends SSTV picture using The following example sends SSTV picture using
SX1278's FSK modem. The data is modulated SX1278's FSK modem. The data is modulated
as AFSK. as AFSK.
Other modules that can be used for SSTV: Other modules that can be used for SSTV:
with AFSK modulation: with AFSK modulation:
- SX127x/RFM9x - SX127x/RFM9x
- RF69 - RF69
- SX1231 - SX1231
- CC1101 - CC1101
- Si443x/RFM2x - Si443x/RFM2x
- SX126x/LLCC68 - SX126x/LLCC68
NOTE: Some platforms (such as Arduino Uno) NOTE: Some platforms (such as Arduino Uno)
might not be fast enough to correctly might not be fast enough to correctly
send pictures via high-speed modes send pictures via high-speed modes
like Scottie2 or Martin2. For those, like Scottie2 or Martin2. For those,
lower speed modes such as Wrasse, lower speed modes such as Wrasse,
Scottie1 or Martin1 are recommended. Scottie1 or Martin1 are recommended.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration
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
@@ -38,9 +38,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct
@@ -1,16 +1,16 @@
/* /*
RadioLib STM32WLx Channel Activity Detection Example RadioLib STM32WLx Channel Activity Detection Example
This example uses STM32WLx to scan the current LoRa This example uses STM32WLx to scan the current LoRa
channel and detect ongoing LoRa transmissions. channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, SX126x/STM32WLx can detect any part Unlike SX127x CAD, SX126x/STM32WLx can detect any part
of LoRa transmission, not just the preamble. of LoRa transmission, not just the preamble.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---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
@@ -1,16 +1,16 @@
/* /*
RadioLib STM32WLx Channel Activity Detection Example RadioLib STM32WLx Channel Activity Detection Example
This example uses STM32WLx to scan the current LoRa This example uses STM32WLx to scan the current LoRa
channel and detect ongoing LoRa transmissions. channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, SX126x/STM32WLx can detect any part Unlike SX127x CAD, SX126x/STM32WLx can detect any part
of LoRa transmission, not just the preamble. of LoRa transmission, not just the preamble.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---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
@@ -1,26 +1,26 @@
/* /*
RadioLib STM32WLx Receive with Interrupts Example RadioLib STM32WLx Receive with Interrupts Example
This example listens for LoRa transmissions and tries to This example listens for LoRa transmissions and tries to
receive them. Once a packet is received, an interrupt is receive them. Once a packet is received, an interrupt is
triggered. To successfully receive data, the following triggered. To successfully receive data, the following
settings have to be the same on both transmitter settings have to be the same on both transmitter
and receiver: and receiver:
- carrier frequency - carrier frequency
- bandwidth - bandwidth
- spreading factor - spreading factor
- coding rate - coding rate
- sync word - sync word
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
or standalone STM32WL, some configuration such as TCXO voltage and or standalone STM32WL, some configuration such as TCXO voltage and
RF switch control may have to be adjusted. RF switch control may have to be adjusted.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---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
@@ -154,8 +154,5 @@ void loop() {
Serial.println(state); Serial.println(state);
} }
// put module back to listen mode
radio.startReceive();
} }
} }
@@ -29,9 +29,13 @@
// RESET pin: 3 // RESET pin: 3
SX1231 radio = new Module(10, 2, 3); SX1231 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1231 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -28,9 +28,13 @@
// RESET pin: 3 // RESET pin: 3
SX1231 radio = new Module(10, 2, 3); SX1231 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1231 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -30,12 +30,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,18 +1,18 @@
/* /*
RadioLib SX126x Channel Activity Detection Example RadioLib SX126x Channel Activity Detection Example
This example uses SX1262 to scan the current LoRa This example uses SX1262 to scan the current LoRa
channel and detect ongoing LoRa transmissions. channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, SX126x can detect any part Unlike SX127x CAD, SX126x can detect any part
of LoRa transmission, not just the preamble. of LoRa transmission, not just the preamble.
Other modules from SX126x family can also be used. Other modules from SX126x 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#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---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
@@ -25,12 +25,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -27,12 +27,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,19 +1,19 @@
/* /*
RadioLib SX126x FSK Modem Example RadioLib SX126x FSK Modem Example
This example shows how to use FSK modem in SX126x chips. This example shows how to use FSK modem in SX126x chips.
NOTE: The sketch below is just a guide on how to use NOTE: The sketch below is just a guide on how to use
FSK modem, so this code should not be run directly! FSK modem, so this code should not be run directly!
Instead, modify the other examples to use FSK Instead, modify the other examples to use FSK
modem and use the appropriate configuration modem and use the appropriate configuration
methods. methods.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---fsk-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---fsk-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
@@ -26,12 +26,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -0,0 +1,95 @@
/*
RadioLib SX126x LR-FHSS Modem Example
This example shows how to use LR-FHSS modem in SX126x chips.
This modem can only transmit data, and is not able to receive.
NOTE: The sketch below is just a guide on how to use
LR-FHSS modem, so this code should not be run directly!
Instead, modify the other examples to use LR-FHSS
modem and use the appropriate configuration
methods.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lr-fhss-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1262 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() {
Serial.begin(9600);
// initialize SX1262 with default settings
Serial.print(F("[SX1262] Initializing ... "));
int state = radio.beginLRFHSS();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// if needed, you can switch between any of the modems
//
// radio.begin() start LoRa modem (and disable LR-FHSS)
// radio.beginLRFHSS() start LR-FHSS modem (and disable LoRa)
// the following settings can also
// be modified at run-time
state = radio.setFrequency(433.5);
state = radio.setLrFhssConfig(RADIOLIB_SX126X_LR_FHSS_BW_1523_4, // bandwidth
RADIOLIB_SX126X_LR_FHSS_CR_1_2, // coding rate
3, // header count
0x13A); // hopping sequence seed
state = radio.setOutputPower(10.0);
state = radio.setSyncWord(0x12345678);
if (state != RADIOLIB_ERR_NONE) {
Serial.print(F("Unable to set configuration, code "));
Serial.println(state);
while (true) { delay(10); }
}
#warning "This sketch is just an API guide! Read the note at line 6."
}
void loop() {
// LR-FHSS modem can only transmit!
// transmit LR-FHSS packet
int state = radio.transmit("Hello World!");
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("[SX1262] Packet transmitted successfully!"));
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
Serial.println(F("[SX1262] Packet too long!"));
} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
Serial.println(F("[SX1262] Timed out while transmitting!"));
} else {
Serial.println(F("[SX1262] Failed to transmit packet, code "));
Serial.println(state);
}
}
@@ -1,11 +1,14 @@
/* /*
RadioLib SX126x Ping-Pong Example RadioLib SX126x Ping-Pong Example
For default module settings, see the wiki page This example is intended to run on two SX126x radios,
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem and send packets between the two.
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#sx126x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library
@@ -22,12 +25,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
// save transmission states between loops // save transmission states between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
@@ -1,28 +1,28 @@
/* /*
RadioLib SX126x Blocking Receive Example RadioLib SX126x Blocking Receive Example
This example listens for LoRa transmissions using SX126x Lora modules. This example listens for LoRa transmissions using SX126x 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 SX126x family can also be used. Other modules from SX126x family can also be used.
Using blocking receive is not recommended, as it will lead Using blocking receive is not recommended, as it will lead
to significant amount of timeouts, inefficient use of processor to significant amount of timeouts, inefficient use of processor
time and can some miss packets! time and can some miss packets!
Instead, interrupt receive is recommended. Instead, interrupt receive is recommended.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---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
@@ -35,12 +35,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,24 +1,24 @@
/* /*
RadioLib SX126x Receive with Interrupts Example RadioLib SX126x Receive with Interrupts Example
This example listens for LoRa transmissions and tries to This example listens for LoRa transmissions and tries to
receive them. Once a packet is received, an interrupt is receive them. Once a packet is received, an interrupt is
triggered. To successfully receive data, the following triggered. To successfully receive data, the following
settings have to be the same on both transmitter settings have to be the same on both transmitter
and receiver: and receiver:
- carrier frequency - carrier frequency
- bandwidth - bandwidth
- spreading factor - spreading factor
- coding rate - coding rate
- sync word - sync word
Other modules from SX126x family can also be used. Other modules from SX126x 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#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---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
@@ -31,12 +31,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,27 +1,27 @@
/* /*
RadioLib SX126x Settings Example RadioLib SX126x Settings Example
This example shows how to change all the properties of LoRa transmission. This example shows how to change all the properties of LoRa transmission.
RadioLib currently supports the following settings: RadioLib currently supports the following settings:
- pins (SPI slave select, DIO1, DIO2, BUSY pin) - pins (SPI slave select, DIO1, DIO2, BUSY pin)
- carrier frequency - carrier frequency
- bandwidth - bandwidth
- spreading factor - spreading factor
- coding rate - coding rate
- sync word - sync word
- output power during transmission - output power during transmission
- CRC - CRC
- preamble length - preamble length
- TCXO voltage - TCXO voltage
- DIO2 RF switch control - DIO2 RF switch control
Other modules from SX126x family can also be used. Other modules from SX126x 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#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---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
@@ -41,12 +41,13 @@ SX1262 radio1 = new Module(10, 2, 3, 9);
// BUSY pin: 6 // BUSY pin: 6
SX1268 radio2 = new Module(8, 4, 5, 6); SX1268 radio2 = new Module(8, 4, 5, 6);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1261 radio3 = RadioShield.ModuleB; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio3 = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,24 +1,24 @@
/* /*
RadioLib SX126x Spectrum Scan Example RadioLib SX126x Spectrum Scan Example
This example shows how to perform a spectrum power scan using SX126x. This example shows how to perform a spectrum power scan using SX126x.
The output is in the form of scan lines, each line has 33 power bins. The output is in the form of scan lines, each line has 33 power bins.
First power bin corresponds to -11 dBm, the second to -15 dBm and so on. First power bin corresponds to -11 dBm, the second to -15 dBm and so on.
Higher number of samples in a bin corresponds to more power received Higher number of samples in a bin corresponds to more power received
at that level. at that level.
To show the results in a plot, run the Python script To show the results in a plot, run the Python script
RadioLib/extras/SX126x_Spectrum_Scan/SpectrumScan.py RadioLib/extras/SX126x_Spectrum_Scan/SpectrumScan.py
WARNING: This functionality is experimental and requires a binary patch WARNING: This functionality is experimental and requires a binary patch
to be uploaded to the SX126x device. There may be some undocumented to be uploaded to the SX126x device. There may be some undocumented
side effects! side effects!
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---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
@@ -34,6 +34,14 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
@@ -1,24 +1,24 @@
/* /*
RadioLib SX126x Spectrum Scan Example RadioLib SX126x Spectrum Scan Example
This example shows how to perform a spectrum power scan using SX126x. This example shows how to perform a spectrum power scan using SX126x.
The output is in the form of scan lines, each line has 33 power bins. The output is in the form of scan lines, each line has 33 power bins.
First power bin corresponds to -11 dBm, the second to -15 dBm and so on. First power bin corresponds to -11 dBm, the second to -15 dBm and so on.
Higher number of samples in a bin corresponds to more power received Higher number of samples in a bin corresponds to more power received
at that level. The example performs frequency sweep over a given range. at that level. The example performs frequency sweep over a given range.
To show the results in a plot, run the Python script To show the results in a plot, run the Python script
RadioLib/extras/SX126x_Spectrum_Scan/SpectrumScan.py RadioLib/extras/SX126x_Spectrum_Scan/SpectrumScan.py
WARNING: This functionality is experimental and requires a binary patch WARNING: This functionality is experimental and requires a binary patch
to be uploaded to the SX126x device. There may be some undocumented to be uploaded to the SX126x device. There may be some undocumented
side effects! side effects!
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---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
@@ -34,6 +34,14 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// frequency range in MHz to scan // frequency range in MHz to scan
const float freqStart = 431; const float freqStart = 431;
const float freqEnd = 435; const float freqEnd = 435;
@@ -30,12 +30,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -27,12 +27,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
@@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,19 +1,19 @@
/* /*
RadioLib SX127x Channel Activity Detection with Interrupts Example RadioLib SX127x Channel Activity Detection with Interrupts 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 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
@@ -26,9 +26,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
// Serial port speed must be high enough for this example // Serial port speed must be high enough for this example
@@ -1,24 +1,24 @@
/* /*
RadioLib SX127x Receive after Channel Activity Detection Example RadioLib SX127x Receive after 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. If a preamble is detected, receiving a message. If a preamble is detected,
the module will switch to receive mode and receive the packet. the module will switch to receive mode and receive the packet.
For most use-cases, it should be enough to just use the For most use-cases, it should be enough to just use the
interrupt-driven reception described in the example interrupt-driven reception described in the example
"SX127x_Receive_Interrupt". "SX127x_Receive_Interrupt".
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
@@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
// Serial port speed must be high enough for this example // Serial port speed must be high enough for this example
@@ -1,19 +1,19 @@
/* /*
RadioLib SX127x FSK Modem Example RadioLib SX127x FSK Modem Example
This example shows how to use FSK modem in SX127x chips. This example shows how to use FSK modem in SX127x chips.
NOTE: The sketch below is just a guide on how to use NOTE: The sketch below is just a guide on how to use
FSK modem, so this code should not be run directly! FSK modem, so this code should not be run directly!
Instead, modify the other examples to use FSK Instead, modify the other examples to use FSK
modem and use the appropriate configuration modem and use the appropriate configuration
methods. methods.
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---fsk-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---fsk-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
@@ -26,9 +26,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,11 +1,14 @@
/* /*
RadioLib SX127x Ping-Pong Example RadioLib SX127x Ping-Pong Example
For default module settings, see the wiki page This example is intended to run on two SX126x radios,
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem and send packets between the two.
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
@@ -22,9 +25,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// save transmission states between loops // save transmission states between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
@@ -35,9 +35,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,14 +1,14 @@
/* /*
RadioLib SX127x Direct Receive Example RadioLib SX127x Direct Receive Example
This example shows how to receive FSK packets without using This example shows how to receive FSK packets without using
SX127x packet engine. SX127x packet engine.
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
@@ -24,9 +24,13 @@ SX1278 radio = new Module(10, 2, 9, 3);
// DIO2 pin: 5 // DIO2 pin: 5
const int pin = 5; const int pin = 5;
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,24 +1,24 @@
/* /*
RadioLib SX127x Transmit with Frequency Hopping Example RadioLib SX127x Transmit with Frequency Hopping Example
This example transmits packets using SX1278 LoRa radio module. This example transmits packets using SX1278 LoRa radio module.
Each packet contains up to 256 bytes of data, in the form of: Each packet contains up to 256 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 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/
SX127x supports FHSS or Frequency Hopping Spread Spectrum. SX127x supports FHSS or Frequency Hopping Spread Spectrum.
Once a hopping period is set and a transmission is started, the radio Once a hopping period is set and a transmission is started, the radio
will begin triggering interrupts every hop period where the radio frequency will begin triggering interrupts every hop period where the radio frequency
is changed to the next channel. is changed to the next channel.
*/ */
#include <RadioLib.h> #include <RadioLib.h>
@@ -30,9 +30,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// flag to indicate that a packet was received // flag to indicate that a packet was received
volatile bool receivedFlag = false; volatile bool receivedFlag = false;
@@ -86,6 +90,7 @@ void setup() {
// set hop period in symbols // set hop period in symbols
// this will also enable FHSS // this will also enable FHSS
Serial.print(F("[SX1278] Setting hopping period ... "));
state = radio.setFHSSHoppingPeriod(9); state = radio.setFHSSHoppingPeriod(9);
if (state == RADIOLIB_ERR_NONE) { if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
@@ -153,6 +158,9 @@ void loop() {
// reset the counter // reset the counter
hopsCompleted = 0; hopsCompleted = 0;
// return to home channel before the next transaction
radio.setFrequency(channels[0]);
// put the module back to listen mode // put the module back to listen mode
radio.startReceive(); radio.startReceive();
@@ -1,24 +1,24 @@
/* /*
RadioLib SX127x Receive with Interrupts Example RadioLib SX127x Receive with Interrupts Example
This example listens for LoRa transmissions and tries to This example listens for LoRa transmissions and tries to
receive them. Once a packet is received, an interrupt is receive them. Once a packet is received, an interrupt is
triggered. To successfully receive data, the following triggered. To successfully receive data, the following
settings have to be the same on both transmitter settings have to be the same on both transmitter
and receiver: and receiver:
- carrier frequency - carrier frequency
- bandwidth - bandwidth
- spreading factor - spreading factor
- coding rate - coding rate
- sync word - sync word
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
@@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,23 +1,23 @@
/* /*
RadioLib SX127x Settings Example RadioLib SX127x Settings Example
This example shows how to change all the properties of LoRa transmission. This example shows how to change all the properties of LoRa transmission.
RadioLib currently supports the following settings: RadioLib currently supports the following settings:
- pins (SPI slave select, digital IO 0, digital IO 1) - pins (SPI slave select, digital IO 0, digital IO 1)
- carrier frequency - carrier frequency
- bandwidth - bandwidth
- spreading factor - spreading factor
- coding rate - coding rate
- sync word - sync word
- output power during transmission - output power during transmission
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
@@ -37,9 +37,13 @@ SX1278 radio1 = new Module(10, 2, 9, 3);
// DIO1 pin: 6 // DIO1 pin: 6
SX1272 radio2 = new Module(9, 4, 5, 6); SX1272 radio2 = new Module(9, 4, 5, 6);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1276 radio3 = RadioShield.ModuleB; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio3 = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -30,9 +30,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,24 +1,24 @@
/* /*
RadioLib SX127x Transmit with Frequency Hopping Example RadioLib SX127x Transmit with Frequency Hopping 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 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/
SX127x supports FHSS or Frequency Hopping Spread Spectrum. SX127x supports FHSS or Frequency Hopping Spread Spectrum.
Once a hopping period is set and a transmission is started, the radio Once a hopping period is set and a transmission is started, the radio
will begin triggering interrupts every hop period where the radio frequency will begin triggering interrupts every hop period where the radio frequency
is changed to the next channel. is changed to the next channel.
*/ */
#include <RadioLib.h> #include <RadioLib.h>
@@ -30,9 +30,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// flag to indicate that a packet was received // flag to indicate that a packet was received
volatile bool transmittedFlag = false; volatile bool transmittedFlag = false;
@@ -98,6 +102,7 @@ void setup() {
// set hop period in symbols // set hop period in symbols
// this will also enable FHSS // this will also enable FHSS
Serial.print(F("[SX1278] Setting hopping period ... "));
state = radio.setFHSSHoppingPeriod(9); state = radio.setFHSSHoppingPeriod(9);
if (state == RADIOLIB_ERR_NONE) { if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
@@ -147,7 +152,7 @@ void loop() {
hopsCompleted = 0; hopsCompleted = 0;
// return to home channel before the next transaction // return to home channel before the next transaction
radio.setFrequency(channels[radio.getFHSSChannel() % numberOfChannels]); radio.setFrequency(channels[0]);
// wait a second before transmitting again // wait a second before transmitting again
delay(1000); delay(1000);
@@ -27,9 +27,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
@@ -1,21 +1,21 @@
/* /*
RadioLib SX128x BLE Modem Example RadioLib SX128x BLE Modem Example
This example shows how to use BLE modem in SX128x chips. This example shows how to use BLE modem in SX128x chips.
RadioLib does not provide BLE protocol support (yet), RadioLib does not provide BLE protocol support (yet),
only compatibility with the physical layer. only compatibility with the physical layer.
NOTE: The sketch below is just a guide on how to use NOTE: The sketch below is just a guide on how to use
BLE modem, so this code should not be run directly! BLE modem, so this code should not be run directly!
Instead, modify the other examples to use BLE Instead, modify the other examples to use BLE
modem and use the appropriate configuration modem and use the appropriate configuration
methods. methods.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx128x---ble-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx128x---ble-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
@@ -28,9 +28,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1280 radio = new Module(10, 2, 3, 9); SX1280 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1280 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -28,9 +28,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1280 radio = new Module(10, 2, 3, 9); SX1280 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1280 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@@ -1,16 +1,16 @@
/* /*
RadioLib SX128x Channel Activity Detection Example RadioLib SX128x Channel Activity Detection Example
This example uses SX1280 to scan the current LoRa This example uses SX1280 to scan the current LoRa
channel and detect ongoing LoRa transmissions. channel and detect ongoing LoRa transmissions.
Other modules from SX128x family can also be used. Other modules from SX128x 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#sx128x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx128x---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
@@ -23,9 +23,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1280 radio = new Module(10, 2, 3, 9); SX1280 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1280 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

Some files were not shown because too many files have changed in this diff Show More