Example sketch showing how to create a simple messageing server with the RF69 class. RF69 class does not provide for addressing or reliability. It is designed to work with the example rf69_client Demonstrates the use of AES encrpyion.
#include <SPI.h>
#include <RF69.h>
void setup()
{
Serial.begin(9600);
Serial.println("RF69 init failed");
Serial.println("RF69 setFrequency failed");
Serial.println("RF69 setModemConfig failed");
uint8_t key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
#if 0
uint8_t syncwords[] = { 0x2d, 0x64 };
#endif
}
void loop()
{
{
uint8_t buf[RF69_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf69.
recv(buf, &len))
{
Serial.print("got request: ");
Serial.println((char*)buf);
uint8_t data[] = "And hello back to you";
rf69.
send(data,
sizeof(data));
Serial.println("Sent a reply");
}
else
{
Serial.println("recv failed");
}
}
}