Advertisement
petkouzunski

Arduino RX

Jul 22nd, 2020
2,556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // RX
  2. #include <SPI.h>
  3. #include "nRF24L01.h"
  4. #include "RF24.h"
  5. #include <printf.h>
  6.  
  7. RF24 radio(7, 8);
  8.  
  9. const uint64_t addr = 0x0a0c0a0c0aLL;
  10. char msg[100];
  11.  
  12. void setup(){
  13.   Serial.begin(9600);
  14.   radio.begin();
  15.   printf_begin();
  16.   radio.openReadingPipe(1, addr);
  17.   radio.startListening();
  18.   radio.printDetails();
  19.   delay(1000);
  20. }
  21.  
  22. void loop(){
  23.   if(radio.available()){
  24.     radio.read(msg, sizeof(msg));
  25.     Serial.println(msg);
  26.   }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement