SX127x - Updated example

This commit is contained in:
Jan Gromeš 2018-07-14 10:27:14 +02:00
parent d630853784
commit 27d2da143e

View file

@ -92,11 +92,16 @@ void setup() {
} }
// you can also change the settings at runtime // you can also change the settings at runtime
// and check if the configuration was changed successfully
// different modules accept different parameters // different modules accept different parameters
// see https://github.com/jgromes/LoRaLib/wiki/Supported-LoRa-modules // see https://github.com/jgromes/LoRaLib/wiki/Supported-LoRa-modules
// you can check if the setting was changed successfully // set carrier frequency to 433.5 MHz
if(loraSX1278.setFrequency(433.5) == ERR_INVALID_FREQUENCY) {
Serial.println("Selected frequency is invalid for this module!");
while(true);
}
// set bandwidth to 250 kHz // set bandwidth to 250 kHz
if(loraSX1278.setBandwidth(250.0) == ERR_INVALID_BANDWIDTH) { if(loraSX1278.setBandwidth(250.0) == ERR_INVALID_BANDWIDTH) {
@ -116,12 +121,6 @@ void setup() {
while(true); while(true);
} }
// set carrier frequency to 433.5 MHz
if(loraSX1278.setFrequency(433.5) == ERR_INVALID_FREQUENCY) {
Serial.println("Selected frequency is invalid for this module!");
while(true);
}
// set LoRa sync word to 0x14 // set LoRa sync word to 0x14
// NOTE: value 0x34 is reserved for LoRaWAN networks and should not be used // NOTE: value 0x34 is reserved for LoRaWAN networks and should not be used
if(loraSX1278.setSyncWord(0x14) != ERR_NONE) { if(loraSX1278.setSyncWord(0x14) != ERR_NONE) {