Advertisement
193030

ESP32-cam NRF24l01

Aug 29th, 2021
995
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. /*
  2. * Arduino Wireless Communication Tutorial
  3. *       Example 1 - Receiver Code
  4. *                
  5. * by Dejan Nedelkovski, www.HowToMechatronics.com
  6. *
  7. * Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
  8. */
  9.  
  10. #include <SPI.h>
  11. #include <nRF24L01.h>
  12. #include <RF24.h>
  13.  
  14. RF24 radio(4, 2); // CE, CSN
  15.  
  16. const byte address[6] = "00001";
  17.  
  18. void setup() {
  19.   Serial.begin(9600);
  20.   radio.begin();
  21.   radio.openReadingPipe(0, address);
  22.   radio.setPALevel(RF24_PA_MIN);
  23.   radio.startListening();
  24. }
  25.  
  26. void loop() {
  27.   if (radio.available()) {
  28.     char text[32] = "";
  29.     radio.read(&text, sizeof(text));
  30.     Serial.println(text);
  31.   }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement