Receive Operation - chandrawi/LoRaRF-Arduino GitHub Wiki
Receive operation begin with calling request()
method following by read()
method to read received package. available()
method can be used to get length of remaining package. For example, to receive message and a counter in last byte you can use following code.
LoRa.request();
LoRa.wait();
// get message and counter in last byte
const uint8_t length = LoRa.available() - 1;
char message[length];
uint8_t i=0;
while (LoRa.available() > 1){
message[i++] = LoRa.read(); // read multiple bytes
}
uint8_t counter = LoRa.read(); // read single byte