Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2020
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <SPI.h>
  2. #include <nRF24L01.h>
  3. #include <RF24.h>
  4. RF24 radio(53, 48); // CE, CSN
  5. const byte numSlaves = 3;
  6. const byte address[numSlaves][6] = {
  7.   {"00001"},
  8.   {"00010"},
  9.   {"00100"}
  10. };
  11. String recv_buff[4];
  12.  
  13. void setup() {
  14.   Serial.begin(9600);
  15.   radio.begin();
  16.   radio.setPALevel(RF24_PA_MIN);
  17.   radio.startListening();
  18. }
  19.  
  20. void loop() {
  21.   for (byte n = 0; n < numSlaves; n++){
  22.       radio.openReadingPipe(0, address[n]);
  23.   if (radio.available()) {
  24.     const char text[32] = "";
  25.     radio.read(&text, sizeof(text));
  26.     String recv_tot = recv_buff[0] + recv_buff[1] + recv_buff[2];
  27.     Serial.println(recv_tot);
  28.     delay(2000);
  29.     }
  30.  
  31.  
  32.   }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement