Right now I have an ESP32-WROOM-32 from AZ Delivery which I've been having fun with. Recently picked up a LoRa module (this one https://uk.farnell.com/seeed-studio/113 ... derack-GLB) but can't for the life of me get any joy. I have taken the Grove connector and jammed some leads in the end and attached them to 3.3v, GND, the RX to pin 16 and the TX to pin 17 (following the pin diagram these should be UART2).
Then I have this code:
Code: Select all
#include <RH_RF95.h>
#define RX_PIN 16
#define TX_PIN 17
int led = 13;
RH_RF95 rf95(TX_PIN, RX_PIN); // Initialize RH_RF95 object with specified TX and RX pins
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("RF95 server test.");
if (!rf95.init()) {
Serial.println("init failed");
while (1);
}
rf95.setFrequency(434.0);
}
void loop() {
if (rf95.available()) {
// Should be a message for us now
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf95.recv(buf, &len)) {
digitalWrite(led, HIGH);
Serial.print("got request: ");
Serial.println((char*)buf);
// Send a reply
uint8_t data[] = "And hello back to you";
rf95.send(data, sizeof(data));
rf95.waitPacketSent();
Serial.println("Sent a reply");
digitalWrite(led, LOW);
} else {
Serial.println("recv failed");
}
}
}