#include <RH_LoRaFileOps.h>
void setup()
{
if (!lora.init())
Serial.println("init failed");
lora.setTxPower(17);
}
void loop()
{
lora.waitAvailable(100);
uint8_t buf[RH_LORAFILEOPS_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (lora.recv(buf, &len))
{
Serial.print("got request: ");
Serial.println((char*)buf);
Serial.print("RSSI: ");
Serial.println(lora.lastRssi(), DEC);
uint8_t data[] = "And hello back to you";
lora.send(data, sizeof(data));
Serial.println("Sent a reply");
}
else
{
Serial.println("recv failed");
}
}
static void printBuffer(const char *prompt, const uint8_t *buf, uint8_t len)
Definition RHGenericDriver.cpp:181
Driver to send and receive unaddressed, unreliable datagrams via a LoRa capable radio transceiver on ...
Definition RH_LoRaFileOps.h:221