I send the complete working code:
#include <SPI.h>
#include <LoRa.h>
// Definisci i pin per il modulo LoRa
const int ss = 5; // Pin CS (Chip Select)
const int rst = 14; // Pin RST (Reset)
const int dio0 = 2; // Pin IRQ (Interrupt Request)
void setup() {
Serial.begin(115200);
while (!Serial);
// Inizializza il modulo LoRa con i pin specifici
LoRa.setPins(ss, rst, dio0);
if (!LoRa.begin(868E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
LoRa.setTxPower(17);
LoRa.setSpreadingFactor(10);
LoRa.setSignalBandwidth(62.5E3);
LoRa.setCodingRate4(8);
}
void loop() {
// il resto del tuo codice
}