You've already forked arduino-LoRa
mirror of
https://github.com/sandeepmistry/arduino-LoRa.git
synced 2025-07-31 10:24:22 +03:00
Added setGain for LNA Gain (#408)
* Added setGain for LNA Gain Added setGain for LNA Gain * Update API.md Added API for setGain * Added example to use setGain Just use setGain after LoRa.begin // set maximum LNA for better RX sensitivity // 0: ADC is used and LNA gain is not used. // 1-6: ADC is not used and LNA gain is used. LoRa.setGain(6); * Fixed spacing only To change tabs to spaces. * Delete LoRaReceiverCallbackWithLNAGain.ino To remove as unnecessary. * To add example for setGain To add example for setGain as an optional setting. * Added setGain To add setGain * Fixed typo for AGC Fixed typo for AGC * Fixed comment for LoRa.setGain(6) * Make comment for setGain simpler Make comment for setGain simpler
This commit is contained in:
@ -1,43 +1,45 @@
|
||||
#include <SPI.h>
|
||||
#include <LoRa.h>
|
||||
|
||||
#ifdef ARDUINO_SAMD_MKRWAN1300
|
||||
#error "This example is not compatible with the Arduino MKR WAN 1300 board!"
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
while (!Serial);
|
||||
|
||||
Serial.println("LoRa Receiver Callback");
|
||||
|
||||
if (!LoRa.begin(915E6)) {
|
||||
Serial.println("Starting LoRa failed!");
|
||||
while (1);
|
||||
}
|
||||
|
||||
// register the receive callback
|
||||
LoRa.onReceive(onReceive);
|
||||
|
||||
// put the radio into receive mode
|
||||
LoRa.receive();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void onReceive(int packetSize) {
|
||||
// received a packet
|
||||
Serial.print("Received packet '");
|
||||
|
||||
// read packet
|
||||
for (int i = 0; i < packetSize; i++) {
|
||||
Serial.print((char)LoRa.read());
|
||||
}
|
||||
|
||||
// print RSSI of packet
|
||||
Serial.print("' with RSSI ");
|
||||
Serial.println(LoRa.packetRssi());
|
||||
}
|
||||
|
||||
#include <SPI.h>
|
||||
#include <LoRa.h>
|
||||
|
||||
#ifdef ARDUINO_SAMD_MKRWAN1300
|
||||
#error "This example is not compatible with the Arduino MKR WAN 1300 board!"
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
while (!Serial);
|
||||
|
||||
Serial.println("LoRa Receiver Callback");
|
||||
|
||||
if (!LoRa.begin(915E6)) {
|
||||
Serial.println("Starting LoRa failed!");
|
||||
while (1);
|
||||
}
|
||||
|
||||
// Uncomment the next line to disable the default AGC and set LNA gain, values between 1 - 6 are supported
|
||||
// LoRa.setGain(6);
|
||||
|
||||
// register the receive callback
|
||||
LoRa.onReceive(onReceive);
|
||||
|
||||
// put the radio into receive mode
|
||||
LoRa.receive();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void onReceive(int packetSize) {
|
||||
// received a packet
|
||||
Serial.print("Received packet '");
|
||||
|
||||
// read packet
|
||||
for (int i = 0; i < packetSize; i++) {
|
||||
Serial.print((char)LoRa.read());
|
||||
}
|
||||
|
||||
// print RSSI of packet
|
||||
Serial.print("' with RSSI ");
|
||||
Serial.println(LoRa.packetRssi());
|
||||
}
|
||||
|
Reference in New Issue
Block a user