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