1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| #include <RF24_config.h>
| #include <nRF24L01.h>
| #include <RF24.h>
| #include <printf.h>
|
| RF24 radio(22, 21); // CE, CSN
| const byte address[6] = {'R','E','C','V', '1'};
| char val[4];
|
| void setup() {
| // put your setup code here, to run once:
|
| Serial.begin(115200);
| radio.begin();
| radio.openReadingPipe(0, address);
| radio.setPALevel(RF24_PA_MIN);
| radio.startListening();
|
| }
|
| void loop() {
| // put your main code here, to run repeatedly:
|
| delay(5);
| radio.startListening();
| if ( radio.available()) {
| while (radio.available()) {
|
| radio.read(&val, sizeof(val));
| Serial.print("Received = ");
| Serial.println(val);
| }
| }
|
| }
|
|