SHARE
TWEET

thing for steven

a guest Jan 19th, 2020 73 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. const int led = 2;
  5. int RMessage = {222};
  6. RF24 radio(7, 8);
  7. const uint64_t pipe = 0xE6;
  8. void setup() {
  9.   pinMode(led, OUTPUT);
  10.  
  11.   radio.begin();
  12.   radio.openReadingPipe(1,pipe);
  13.   radio.startListening();
  14.    
  15.   radio.setPALevel(RF24_PA_MAX);
  16. }
  17. void loop() {
  18.  
  19.   while (radio.available());
  20.   {
  21.   radio.read(RMessage, 1);
  22.   if (RMessage == 111) {
  23.     digitalWrite(led, HIGH);
  24.   }
  25.   else {
  26.     digitalWrite(led, LOW);
  27.     Serial.print(RMessage);
  28.   }
  29. }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top