Advertisement
hwthinker

Nano nRF24L01 - Receiver

May 17th, 2021
1,192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // receiver
  2. #include <SPI.h>
  3. #include <nRF24L01.h>
  4. #include <RF24.h>
  5.  
  6. RF24 radio(7, 8); // CE, CSN
  7.  
  8. const byte address[6] = "00001";
  9.  
  10. void setup() {
  11.   Serial.begin(9600);
  12.   radio.begin();
  13.   radio.openReadingPipe(0, address);
  14.   radio.setPALevel(RF24_PA_MIN);
  15.   radio.startListening();
  16. }
  17.  
  18. void loop() {
  19.   if (radio.available()) {
  20.     char text[32] = "";
  21.     radio.read(&text, sizeof(text));
  22.     Serial.println(text);
  23.   }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement