Advertisement
Guest User

thing for steven

a guest
Jan 19th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <SPI.h>
  2. #include <nRF24L01.h>
  3. #include <RF24.h>
  4. int button = 0;
  5. const uint64_t pipe = 0xE6;
  6. int SMessage[1] = {000};
  7. RF24 radio(7, 8);
  8.  
  9.  
  10. void setup() {
  11.  
  12. pinMode(button, INPUT);
  13. radio.begin();
  14. radio.openWritingPipe(pipe);
  15.  
  16. radio.setPALevel(RF24_PA_MAX);
  17. }
  18. void loop() {
  19.  
  20. if (digitalRead(button) == HIGH) {
  21. SMessage[0] = 111;
  22. radio.write(SMessage, 1);
  23. }
  24. else {
  25. SMessage[0] = 000;
  26. radio.write(SMessage, 1);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement