Advertisement
Guest User

Untitled

a guest
May 27th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <sstream>
  4. #include <string>
  5. #include <unistd.h>
  6. #include <RF24/RF24.h>
  7.  
  8. RF24 radio(15, 67); // CE, CSN
  9. const uint8_t adresses[][6] = {"00000","00001","2Node","3Node","4Node",$
  10. const char text[] = "Coucou Led allumée";
  11.  
  12. void setup()
  13. {
  14. radio.begin();
  15. radio.openReadingPipe(1,adresses[0]);//00000
  16. radio.openWritingPipe(adresses[1]);//00001
  17. radio.setPALevel(RF24_PA_LOW);
  18. radio.setDataRate(RF24_250KBPS);
  19. radio.printDetails();
  20.  
  21. }
  22. void loop()
  23. {
  24. radio.stopListening();
  25. printf( "On arrête d'écouter pour envoyer\n\r");
  26. radio.write(&text, sizeof(text));
  27. printf("Texte envoyé\n\r");
  28. delay(1000);
  29. }
  30. int main(int argc, char** argv){
  31. setup();
  32. printf ("Setup fait !\n\r");
  33. while (1) loop();
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement