You can try this connection:
LoRa MISO → ESP32 MISO (usually GPIO 19 on the ESP32)
LoRa MOSI → ESP32 MOSI (usually GPIO 23 on the ESP32)
LoRa SCK → ESP32 SCK (usually GPIO 18 on the ESP32)
LoRa CS → ESP32 GPIO5 (you can select any GPIO)
LoRa RST → ESP32 GPIO14 (or any GPIO)
LoRa DIO0 → ESP32 GPIO26 (or any GPIO)
Then try this code:
#include <SPI.h>
#include <LoRa.h>
void setup() {
// Start Serial Monitor
Serial.begin(9600);
// Initialize LoRa module
LoRa.setPins(5, 14, 26); // CS, RST, DIO0 pins
if (!LoRa.begin(915E6)) { // 915 MHz frequency for LoRa
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
Serial.println("Sending packet...");
// Start packet
LoRa.beginPacket();
LoRa.print("Hello, LoRa!");
LoRa.endPacket();
delay(1000);
}