diff --git a/examples/SX126x/SX126x_Channel_Activity_Detection/SX126x_Channel_Activity_Detection.ino b/examples/SX126x/SX126x_Channel_Activity_Detection/SX126x_Channel_Activity_Detection.ino index 99209b99..b888a95d 100644 --- a/examples/SX126x/SX126x_Channel_Activity_Detection/SX126x_Channel_Activity_Detection.ino +++ b/examples/SX126x/SX126x_Channel_Activity_Detection/SX126x_Channel_Activity_Detection.ino @@ -8,6 +8,9 @@ Other modules from SX126x family can also be used. + For default module settings, see the wiki page + https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem + For full API reference, see the GitHub Pages https://jgromes.github.io/RadioLib/ */ @@ -20,29 +23,18 @@ // DIO1 pin: 2 // NRST pin: 3 // BUSY pin: 9 -SX1262 lora = new Module(10, 2, 3, 9); +SX1262 radio = new Module(10, 2, 3, 9); // or using RadioShield // https://github.com/jgromes/RadioShield -//SX1262 lora = RadioShield.ModuleA; +//SX1262 radio = RadioShield.ModuleA; void setup() { Serial.begin(9600); // initialize SX1262 with default settings Serial.print(F("[SX1262] Initializing ... ")); - // carrier frequency: 434.0 MHz - // bandwidth: 125.0 kHz - // spreading factor: 9 - // coding rate: 7 - // sync word: 0x12 (private network) - // output power: 14 dBm - // current limit: 60 mA - // preamble length: 8 symbols - // TCXO voltage: 1.6 V (set to 0 to not use TCXO) - // regulator: DC-DC (set to true to use LDO) - // CRC: enabled - int state = lora.begin(); + int state = radio.begin(); if (state == ERR_NONE) { Serial.println(F("success!")); } else { @@ -56,7 +48,7 @@ void loop() { Serial.print(F("[SX1262] Scanning channel for LoRa transmission ... ")); // start scanning current channel - int state = lora.scanChannel(); + int state = radio.scanChannel(); if (state == LORA_DETECTED) { // LoRa preamble was detected diff --git a/examples/SX126x/SX126x_FSK_Modem/SX126x_FSK_Modem.ino b/examples/SX126x/SX126x_FSK_Modem/SX126x_FSK_Modem.ino index 90730ed0..13411fdd 100644 --- a/examples/SX126x/SX126x_FSK_Modem/SX126x_FSK_Modem.ino +++ b/examples/SX126x/SX126x_FSK_Modem/SX126x_FSK_Modem.ino @@ -9,6 +9,9 @@ modem and use the appropriate configuration methods. + For default module settings, see the wiki page + https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---fsk-modem + For full API reference, see the GitHub Pages https://jgromes.github.io/RadioLib/ */ @@ -21,30 +24,18 @@ // DIO1 pin: 2 // NRST pin: 3 // BUSY pin: 9 -SX1262 fsk = new Module(10, 2, 3, 9); +SX1262 radio = new Module(10, 2, 3, 9); // or using RadioShield // https://github.com/jgromes/RadioShield -//SX1262 fsk = RadioShield.ModuleA; +//SX1262 radio = RadioShield.ModuleA; void setup() { Serial.begin(9600); // initialize SX1262 FSK modem with default settings Serial.print(F("[SX1262] Initializing ... ")); - // carrier frequency: 434.0 MHz - // bit rate: 48.0 kbps - // frequency deviation: 50.0 kHz - // Rx bandwidth: 156.2 kHz - // output power: 14 dBm - // current limit: 60.0 mA - // preamble length: 16 bits - // data shaping: Gaussian, BT = 0.5 - // TCXO voltage: 1.6 V (set to 0 to not use TCXO) - // regulator: DC-DC (set to true to use LDO) - // sync word: 0x2D 0x01 - // CRC: enabled, CRC16 (CCIT) - int state = fsk.beginFSK(); + int state = radio.beginFSK(); if (state == ERR_NONE) { Serial.println(F("success!")); } else { @@ -55,21 +46,21 @@ void setup() { // if needed, you can switch between LoRa and FSK modes // - // lora.begin() start LoRa mode (and disable FSK) - // lora.beginFSK() start FSK mode (and disable LoRa) + // radio.begin() start LoRa mode (and disable FSK) + // radio.beginFSK() start FSK mode (and disable LoRa) // the following settings can also // be modified at run-time - state = fsk.setFrequency(433.5); - state = fsk.setBitRate(100.0); - state = fsk.setFrequencyDeviation(10.0); - state = fsk.setRxBandwidth(250.0); - state = fsk.setOutputPower(10.0); - state = fsk.setCurrentLimit(100.0); - state = fsk.setDataShaping(1.0); + state = radio.setFrequency(433.5); + state = radio.setBitRate(100.0); + state = radio.setFrequencyDeviation(10.0); + state = radio.setRxBandwidth(250.0); + state = radio.setOutputPower(10.0); + state = radio.setCurrentLimit(100.0); + state = radio.setDataShaping(1.0); uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; - state = fsk.setSyncWord(syncWord, 8); + state = radio.setSyncWord(syncWord, 8); if (state != ERR_NONE) { Serial.print(F("Unable to set configuration, code ")); Serial.println(state); @@ -78,15 +69,15 @@ void setup() { // FSK modem on SX126x can handle the sync word setting in bits, not just // whole bytes. The value used is left-justified. - // This makes same result as fsk.setSyncWord(syncWord, 8): - state = fsk.setSyncBits(syncWord, 64); + // This makes same result as radio.setSyncWord(syncWord, 8): + state = radio.setSyncBits(syncWord, 64); // This will use 0x012 as sync word (12 bits only): - state = fsk.setSyncBits(syncWord, 12); + state = radio.setSyncBits(syncWord, 12); // FSK modem allows advanced CRC configuration // Default is CCIT CRC16 (2 bytes, initial 0x1D0F, polynomial 0x1021, inverted) // Set CRC to IBM CRC (2 bytes, initial 0xFFFF, polynomial 0x8005, non-inverted) - state = fsk.setCRC(2, 0xFFFF, 0x8005, false); + state = radio.setCRC(2, 0xFFFF, 0x8005, false); // set CRC length to 0 to disable CRC #warning "This sketch is just an API guide! Read the note at line 6." @@ -97,11 +88,11 @@ void loop() { // as the LoRa modem, even their interrupt-driven versions // transmit FSK packet - int state = fsk.transmit("Hello World!"); + int state = radio.transmit("Hello World!"); /* byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; - int state = lora.transmit(byteArr, 8); + int state = radio.transmit(byteArr, 8); */ if (state == ERR_NONE) { Serial.println(F("[SX1262] Packet transmitted successfully!")); @@ -116,10 +107,10 @@ void loop() { // receive FSK packet String str; - state = fsk.receive(str); + state = radio.receive(str); /* byte byteArr[8]; - int state = lora.receive(byteArr, 8); + int state = radio.receive(byteArr, 8); */ if (state == ERR_NONE) { Serial.println(F("[SX1262] Received packet!")); @@ -139,13 +130,13 @@ void loop() { // to transmit packet to a particular address, // use the following methods: // - // fsk.transmit("Hello World!", address); - // fsk.startTransmit("Hello World!", address); + // radio.transmit("Hello World!", address); + // radio.startTransmit("Hello World!", address); // set node address to 0x02 - state = fsk.setNodeAddress(0x02); + state = radio.setNodeAddress(0x02); // set broadcast address to 0xFF - state = fsk.setBroadcastAddress(0xFF); + state = radio.setBroadcastAddress(0xFF); if (state != ERR_NONE) { Serial.println(F("[SX1262] Unable to set address filter, code ")); Serial.println(state); @@ -155,7 +146,7 @@ void loop() { // NOTE: calling this method will also erase previously set // node and broadcast address /* - state = fsk.disableAddressFiltering(); + state = radio.disableAddressFiltering(); if (state != ERR_NONE) { Serial.println(F("Unable to remove address filter, code ")); } diff --git a/examples/SX126x/SX126x_Receive/SX126x_Receive.ino b/examples/SX126x/SX126x_Receive/SX126x_Receive.ino index c95592f0..23969cb1 100644 --- a/examples/SX126x/SX126x_Receive/SX126x_Receive.ino +++ b/examples/SX126x/SX126x_Receive/SX126x_Receive.ino @@ -13,6 +13,9 @@ Other modules from SX126x family can also be used. + For default module settings, see the wiki page + https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem + For full API reference, see the GitHub Pages https://jgromes.github.io/RadioLib/ */ @@ -25,29 +28,18 @@ // DIO1 pin: 2 // NRST pin: 3 // BUSY pin: 9 -SX1262 lora = new Module(10, 2, 3, 9); +SX1262 radio = new Module(10, 2, 3, 9); // or using RadioShield // https://github.com/jgromes/RadioShield -//SX1262 lora = RadioShield.ModuleA; +//SX1262 radio = RadioShield.ModuleA; void setup() { Serial.begin(9600); // initialize SX1262 with default settings Serial.print(F("[SX1262] Initializing ... ")); - // carrier frequency: 434.0 MHz - // bandwidth: 125.0 kHz - // spreading factor: 9 - // coding rate: 7 - // sync word: 0x12 (private network) - // output power: 14 dBm - // current limit: 60 mA - // preamble length: 8 symbols - // TCXO voltage: 1.6 V (set to 0 to not use TCXO) - // regulator: DC-DC (set to true to use LDO) - // CRC: enabled - int state = lora.begin(); + int state = radio.begin(); if (state == ERR_NONE) { Serial.println(F("success!")); } else { @@ -65,12 +57,12 @@ void loop() { // See example ReceiveInterrupt for details // on non-blocking reception method. String str; - int state = lora.receive(str); + int state = radio.receive(str); // you can also receive data as byte array /* byte byteArr[8]; - int state = lora.receive(byteArr, 8); + int state = radio.receive(byteArr, 8); */ if (state == ERR_NONE) { @@ -84,13 +76,13 @@ void loop() { // print the RSSI (Received Signal Strength Indicator) // of the last received packet Serial.print(F("[SX1262] RSSI:\t\t")); - Serial.print(lora.getRSSI()); + Serial.print(radio.getRSSI()); Serial.println(F(" dBm")); // print the SNR (Signal-to-Noise Ratio) // of the last received packet Serial.print(F("[SX1262] SNR:\t\t")); - Serial.print(lora.getSNR()); + Serial.print(radio.getSNR()); Serial.println(F(" dB")); } else if (state == ERR_RX_TIMEOUT) { diff --git a/examples/SX126x/SX126x_Receive_Interrupt/SX126x_Receive_Interrupt.ino b/examples/SX126x/SX126x_Receive_Interrupt/SX126x_Receive_Interrupt.ino index 59d49f53..3932f7b0 100644 --- a/examples/SX126x/SX126x_Receive_Interrupt/SX126x_Receive_Interrupt.ino +++ b/examples/SX126x/SX126x_Receive_Interrupt/SX126x_Receive_Interrupt.ino @@ -12,7 +12,10 @@ - coding rate - sync word - Other modules from SX126x/RFM9x family can also be used. + Other modules from SX126x family can also be used. + + For default module settings, see the wiki page + https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem For full API reference, see the GitHub Pages https://jgromes.github.io/RadioLib/ @@ -26,29 +29,18 @@ // DIO1 pin: 2 // NRST pin: 3 // BUSY pin: 9 -SX1262 lora = new Module(10, 2, 3, 9); +SX1262 radio = new Module(10, 2, 3, 9); // or using RadioShield // https://github.com/jgromes/RadioShield -//SX1262 lora = RadioShield.ModuleA; +//SX1262 radio = RadioShield.ModuleA; void setup() { Serial.begin(9600); // initialize SX1262 with default settings Serial.print(F("[SX1262] Initializing ... ")); - // carrier frequency: 434.0 MHz - // bandwidth: 125.0 kHz - // spreading factor: 9 - // coding rate: 7 - // sync word: 0x12 (private network) - // output power: 14 dBm - // current limit: 60 mA - // preamble length: 8 symbols - // TCXO voltage: 1.6 V (set to 0 to not use TCXO) - // regulator: DC-DC (set to true to use LDO) - // CRC: enabled - int state = lora.begin(); + int state = radio.begin(); if (state == ERR_NONE) { Serial.println(F("success!")); } else { @@ -59,11 +51,11 @@ void setup() { // set the function that will be called // when new packet is received - lora.setDio1Action(setFlag); + radio.setDio1Action(setFlag); // start listening for LoRa packets Serial.print(F("[SX1262] Starting to listen ... ")); - state = lora.startReceive(); + state = radio.startReceive(); if (state == ERR_NONE) { Serial.println(F("success!")); } else { @@ -75,12 +67,12 @@ void setup() { // if needed, 'listen' mode can be disabled by calling // any of the following methods: // - // lora.standby() - // lora.sleep() - // lora.transmit(); - // lora.receive(); - // lora.readData(); - // lora.scanChannel(); + // radio.standby() + // radio.sleep() + // radio.transmit(); + // radio.receive(); + // radio.readData(); + // radio.scanChannel(); } // flag to indicate that a packet was received @@ -115,12 +107,12 @@ void loop() { // you can read received data as an Arduino String String str; - int state = lora.readData(str); + int state = radio.readData(str); // you can also read received data as byte array /* byte byteArr[8]; - int state = lora.readData(byteArr, 8); + int state = radio.readData(byteArr, 8); */ if (state == ERR_NONE) { @@ -133,12 +125,12 @@ void loop() { // print RSSI (Received Signal Strength Indicator) Serial.print(F("[SX1262] RSSI:\t\t")); - Serial.print(lora.getRSSI()); + Serial.print(radio.getRSSI()); Serial.println(F(" dBm")); // print SNR (Signal-to-Noise Ratio) Serial.print(F("[SX1262] SNR:\t\t")); - Serial.print(lora.getSNR()); + Serial.print(radio.getSNR()); Serial.println(F(" dB")); } else if (state == ERR_CRC_MISMATCH) { @@ -153,7 +145,7 @@ void loop() { } // put module back to listen mode - lora.startReceive(); + radio.startReceive(); // we're ready to receive more packets, // enable interrupt service routine diff --git a/examples/SX126x/SX126x_Settings/SX126x_Settings.ino b/examples/SX126x/SX126x_Settings/SX126x_Settings.ino index 3da7d650..5e34d203 100644 --- a/examples/SX126x/SX126x_Settings/SX126x_Settings.ino +++ b/examples/SX126x/SX126x_Settings/SX126x_Settings.ino @@ -17,6 +17,9 @@ Other modules from SX126x family can also be used. + For default module settings, see the wiki page + https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem + For full API reference, see the GitHub Pages https://jgromes.github.io/RadioLib/ */ @@ -29,14 +32,14 @@ // DIO1 pin: 2 // NRST pin: 3 // BUSY pin: 9 -SX1262 loraSX1262 = new Module(10, 2, 3, 9); +SX1262 radio1 = new Module(10, 2, 3, 9); // SX12628 has different connections: // NSS pin: 8 // DIO1 pin: 4 // NRST pin: 5 // BUSY pin: 6 -SX1268 loraSX1268 = new Module(8, 4, 5, 6); +SX1268 radio2 = new Module(8, 4, 5, 6); // or using RadioShield // https://github.com/jgromes/RadioShield @@ -47,18 +50,7 @@ void setup() { // initialize SX1268 with default settings Serial.print(F("[SX1262] Initializing ... ")); - // carrier frequency: 434.0 MHz - // bandwidth: 125.0 kHz - // spreading factor: 9 - // coding rate: 7 - // sync word: 0x12 (private network) - // output power: 14 dBm - // current limit: 60 mA - // preamble length: 8 symbols - // TCXO voltage: 1.6 V (set to 0 to not use TCXO) - // regulator: DC-DC (set to true to use LDO) - // CRC: enabled - int state = loraSX1262.begin(); + int state = radio1.begin(); if (state == ERR_NONE) { Serial.println(F("success!")); } else { @@ -80,8 +72,7 @@ void setup() { // output power: 2 dBm // current limit: 50 mA // preamble length: 20 symbols - // CRC: enabled - state = loraSX1268.begin(915.0, 500.0, 6, 5, 0x34, 50, 20); + state = radio2.begin(915.0, 500.0, 6, 5, 0x34, 50, 20); if (state == ERR_NONE) { Serial.println(F("success!")); } else { @@ -94,56 +85,56 @@ void setup() { // and check if the configuration was changed successfully // set carrier frequency to 433.5 MHz - if (loraSX1262.setFrequency(433.5) == ERR_INVALID_FREQUENCY) { + if (radio1.setFrequency(433.5) == ERR_INVALID_FREQUENCY) { Serial.println(F("Selected frequency is invalid for this module!")); while (true); } // set bandwidth to 250 kHz - if (loraSX1262.setBandwidth(250.0) == ERR_INVALID_BANDWIDTH) { + if (radio1.setBandwidth(250.0) == ERR_INVALID_BANDWIDTH) { Serial.println(F("Selected bandwidth is invalid for this module!")); while (true); } // set spreading factor to 10 - if (loraSX1262.setSpreadingFactor(10) == ERR_INVALID_SPREADING_FACTOR) { + if (radio1.setSpreadingFactor(10) == ERR_INVALID_SPREADING_FACTOR) { Serial.println(F("Selected spreading factor is invalid for this module!")); while (true); } // set coding rate to 6 - if (loraSX1262.setCodingRate(6) == ERR_INVALID_CODING_RATE) { + if (radio1.setCodingRate(6) == ERR_INVALID_CODING_RATE) { Serial.println(F("Selected coding rate is invalid for this module!")); while (true); } // set LoRa sync word to 0xAB - if (loraSX1262.setSyncWord(0xAB) != ERR_NONE) { + if (radio1.setSyncWord(0xAB) != ERR_NONE) { Serial.println(F("Unable to set sync word!")); while (true); } // set output power to 10 dBm (accepted range is -17 - 22 dBm) - if (loraSX1262.setOutputPower(10) == ERR_INVALID_OUTPUT_POWER) { + if (radio1.setOutputPower(10) == ERR_INVALID_OUTPUT_POWER) { Serial.println(F("Selected output power is invalid for this module!")); while (true); } // set over current protection limit to 80 mA (accepted range is 45 - 240 mA) // NOTE: set value to 0 to disable overcurrent protection - if (loraSX1262.setCurrentLimit(80) == ERR_INVALID_CURRENT_LIMIT) { + if (radio1.setCurrentLimit(80) == ERR_INVALID_CURRENT_LIMIT) { Serial.println(F("Selected current limit is invalid for this module!")); while (true); } // set LoRa preamble length to 15 symbols (accepted range is 0 - 65535) - if (loraSX1262.setPreambleLength(15) == ERR_INVALID_PREAMBLE_LENGTH) { + if (radio1.setPreambleLength(15) == ERR_INVALID_PREAMBLE_LENGTH) { Serial.println(F("Selected preamble length is invalid for this module!")); while (true); } // disable CRC - if (loraSX1262.setCRC(false) == ERR_INVALID_CRC_CONFIGURATION) { + if (radio1.setCRC(false) == ERR_INVALID_CRC_CONFIGURATION) { Serial.println(F("Selected CRC is invalid for this module!")); while (true); } @@ -151,7 +142,7 @@ void setup() { // Some SX126x modules have TCXO (temperature compensated crystal // oscillator). To configure TCXO reference voltage, // the following method can be used. - if (loraSX1262.setTCXO(2.4) == ERR_INVALID_TCXO_VOLTAGE) { + if (radio1.setTCXO(2.4) == ERR_INVALID_TCXO_VOLTAGE) { Serial.println(F("Selected TCXO voltage is invalid for this module!")); while (true); } @@ -160,7 +151,7 @@ void setup() { // this feature, the following method can be used. // NOTE: As long as DIO2 is configured to control RF switch, // it can't be used as interrupt pin! - if (loraSX1262.setDio2AsRfSwitch() != ERR_NONE) { + if (radio1.setDio2AsRfSwitch() != ERR_NONE) { Serial.println(F("Failed to set DIO2 as RF switch!")); while (true); } diff --git a/examples/SX126x/SX126x_Transmit/SX126x_Transmit.ino b/examples/SX126x/SX126x_Transmit/SX126x_Transmit.ino index 338bf3f5..541645ee 100644 --- a/examples/SX126x/SX126x_Transmit/SX126x_Transmit.ino +++ b/examples/SX126x/SX126x_Transmit/SX126x_Transmit.ino @@ -9,6 +9,9 @@ Other modules from SX126x family can also be used. + For default module settings, see the wiki page + https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem + For full API reference, see the GitHub Pages https://jgromes.github.io/RadioLib/ */ @@ -21,29 +24,18 @@ // DIO1 pin: 2 // NRST pin: 3 // BUSY pin: 9 -SX1262 lora = new Module(10, 2, 3, 9); +SX1262 radio = new Module(10, 2, 3, 9); // or using RadioShield // https://github.com/jgromes/RadioShield -//SX1262 lora = RadioShield.ModuleA; +//SX1262 radio = RadioShield.ModuleA; void setup() { Serial.begin(9600); // initialize SX1262 with default settings Serial.print(F("[SX1262] Initializing ... ")); - // carrier frequency: 434.0 MHz - // bandwidth: 125.0 kHz - // spreading factor: 9 - // coding rate: 7 - // sync word: 0x12 (private network) - // output power: 14 dBm - // current limit: 60 mA - // preamble length: 8 symbols - // TCXO voltage: 1.6 V (set to 0 to not use TCXO) - // regulator: DC-DC (set to true to use LDO) - // CRC: enabled - int state = lora.begin(); + int state = radio.begin(); if (state == ERR_NONE) { Serial.println(F("success!")); } else { @@ -59,7 +51,7 @@ void setup() { // RX enable: 4 // TX enable: 5 /* - lora.setRfSwitchPins(4, 5); + radio.setRfSwitchPins(4, 5); */ } @@ -71,12 +63,12 @@ void loop() { // NOTE: transmit() is a blocking method! // See example SX126x_Transmit_Interrupt for details // on non-blocking transmission method. - int state = lora.transmit("Hello World!"); + int state = radio.transmit("Hello World!"); // you can also transmit byte array up to 256 bytes long /* byte byteArr[] = {0x01, 0x23, 0x45, 0x56, 0x78, 0xAB, 0xCD, 0xEF}; - int state = lora.transmit(byteArr, 8); + int state = radio.transmit(byteArr, 8); */ if (state == ERR_NONE) { @@ -85,7 +77,7 @@ void loop() { // print measured data rate Serial.print(F("[SX1262] Datarate:\t")); - Serial.print(lora.getDataRate()); + Serial.print(radio.getDataRate()); Serial.println(F(" bps")); } else if (state == ERR_PACKET_TOO_LONG) { diff --git a/examples/SX126x/SX126x_Transmit_Interrupt/SX126x_Transmit_Interrupt.ino b/examples/SX126x/SX126x_Transmit_Interrupt/SX126x_Transmit_Interrupt.ino index 724e05dc..20600a11 100644 --- a/examples/SX126x/SX126x_Transmit_Interrupt/SX126x_Transmit_Interrupt.ino +++ b/examples/SX126x/SX126x_Transmit_Interrupt/SX126x_Transmit_Interrupt.ino @@ -10,6 +10,9 @@ Other modules from SX126x family can also be used. + For default module settings, see the wiki page + https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem + For full API reference, see the GitHub Pages https://jgromes.github.io/RadioLib/ */ @@ -22,7 +25,11 @@ // DIO1 pin: 2 // NRST pin: 3 // BUSY pin: 9 -SX1262 lora = new Module(10, 2, 3, 9); +SX1262 radio = new Module(10, 2, 3, 9); + +// or using RadioShield +// https://github.com/jgromes/RadioShield +//SX1262 radio = RadioShield.ModuleA; // save transmission state between loops int transmissionState = ERR_NONE; @@ -32,18 +39,7 @@ void setup() { // initialize SX1262 with default settings Serial.print(F("[SX1262] Initializing ... ")); - // carrier frequency: 434.0 MHz - // bandwidth: 125.0 kHz - // spreading factor: 9 - // coding rate: 7 - // sync word: 0x12 (private network) - // output power: 14 dBm - // current limit: 60 mA - // preamble length: 8 symbols - // TCXO voltage: 1.6 V (set to 0 to not use TCXO) - // regulator: DC-DC (set to true to use LDO) - // CRC: enabled - int state = lora.begin(); + int state = radio.begin(); if (state == ERR_NONE) { Serial.println(F("success!")); } else { @@ -54,20 +50,20 @@ void setup() { // set the function that will be called // when packet transmission is finished - lora.setDio1Action(setFlag); + radio.setDio1Action(setFlag); // start transmitting the first packet Serial.print(F("[SX1262] Sending first packet ... ")); // you can transmit C-string or Arduino string up to // 256 characters long - transmissionState = lora.startTransmit("Hello World!"); + transmissionState = radio.startTransmit("Hello World!"); // you can also transmit byte array up to 256 bytes long /* byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; - state = lora.startTransmit(byteArr, 8); + state = radio.startTransmit(byteArr, 8); */ } @@ -123,13 +119,13 @@ void loop() { // you can transmit C-string or Arduino string up to // 256 characters long - transmissionState = lora.startTransmit("Hello World!"); + transmissionState = radio.startTransmit("Hello World!"); // you can also transmit byte array up to 256 bytes long /* byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; - int state = lora.startTransmit(byteArr, 8); + int state = radio.startTransmit(byteArr, 8); */ // we're ready to send more packets,