Server side of simple client/server pair using RF22 class
#include <SPI.h>
#include <RF22.h>
void setup()
{
Serial.begin(9600);
Serial.println("RF22 init failed");
}
void loop()
{
{
uint8_t buf[RF22_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf22.
recv(buf, &len))
{
Serial.print("got request: ");
Serial.println((char*)buf);
uint8_t data[] = "And hello back to you";
rf22.
send(data,
sizeof(data));
Serial.println("Sent a reply");
}
else
{
Serial.println("recv failed");
}
}
}