Datasheet
Its pretty simple, the delay does the waiting, you can replace that with low power sleep code. Then it generates the
packet and appends a number that increases every tx. Then it simply calls send to transmit the data, and passes in the
array of data and the length of the data.
Note that this does not any addressing or subnetworking - if you want to make sure the packet goes to a particular
radio, you may have to add an identifier/address byte on your own!
Then you call waitPacketSent() to wait until the radio is done transmitting. You will not get an automatic
acknowledgement, from the other radio unless it knows to send back a packet. Think of it like the 'UDP' of radio - the
data is sent, but its not certain it was received! Also, there will not be any automatic retries.
Receiver Code
The Receiver has the same exact setup code, but the loop is different
Instead of transmitting, it is constantly checking if there's any data packets that have been received. available() will
return true if a packet with proper error-correction was received. If so, the receiver prints it out in hex and also as a
'character string'
It also prints out the RSSI which is the receiver signal strength indicator. This number will range from about -15 to about
-100. The larger the number (-15 being the highest you'll likely see) the stronger the signal.
void loop()
{
delay(1000); // Wait 1 second between transmits, could also 'sleep' here!
Serial.println("Transmitting..."); // Send a message to rf95_server
char radiopacket[20] = "Hello World # ";
itoa(packetnum++, radiopacket+13, 10);
Serial.print("Sending "); Serial.println(radiopacket);
radiopacket[19] = 0;
Serial.println("Sending..."); delay(10);
rf95.send((uint8_t *)radiopacket, 20);
Serial.println("Waiting for packet to complete..."); delay(10);
rf95.waitPacketSent();
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);
RH_RF95::printBuffer("Received: ", buf, len);
Serial.print("Got: ");
Serial.println((char*)buf);
Serial.print("RSSI: ");
Serial.println(rf95.lastRssi(), DEC);
© Adafruit Industries
https://learn.adafruit.com/adafruit-rfm69hcw-and-rfm96-rfm95-rfm98-lora-packet-padio-
breakouts
Page 66 of 70