|
@ -0,0 +1,27 @@ |
|
|
|
|
|
#include <SPI.h>
|
|
|
|
|
|
#include <nRF24L01.h>
|
|
|
|
|
|
#include <RF24.h>
|
|
|
|
|
|
|
|
|
|
|
|
RF24 radio(3, 2); // CE, CSN
|
|
|
|
|
|
|
|
|
|
|
|
const byte address[6] = "00001"; |
|
|
|
|
|
|
|
|
|
|
|
void setup() { |
|
|
|
|
|
Serial.begin(9600); |
|
|
|
|
|
|
|
|
|
|
|
radio.begin(); |
|
|
|
|
|
radio.openReadingPipe(0, address); |
|
|
|
|
|
radio.setPALevel(RF24_PA_MAX); |
|
|
|
|
|
radio.startListening(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void loop() { |
|
|
|
|
|
if (radio.available()) { |
|
|
|
|
|
char text[32] = ""; |
|
|
|
|
|
|
|
|
|
|
|
radio.read(&text, sizeof(text)); |
|
|
|
|
|
|
|
|
|
|
|
Serial.print("recieved: "); |
|
|
|
|
|
Serial.println(text); |
|
|
|
|
|
} |
|
|
|
|
|
} |