safwan092

TX - NRF24L01

Apr 18th, 2021 (edited)
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. /*
  2. * Arduino Wireless Communication Tutorial
  3. *     Example 1 - Transmitter 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(7, 8); // CE, CSN
  15.  
  16. const byte address[6] = "00001";
  17.  
  18. void setup() {
  19.   radio.begin();
  20.   radio.openWritingPipe(address);
  21.   radio.setPALevel(RF24_PA_MIN);
  22.   radio.stopListening();
  23. }
  24.  
  25. void loop() {
  26.   const char text[] = "Hello World";
  27.   radio.write(&text, sizeof(text));
  28.   delay(1000);
  29. }
Add Comment
Please, Sign In to add comment