SHARE
TWEET

TX-NRF

a guest Oct 21st, 2014 206 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <nRF24L01.h>
  2. #include <RF24.h>
  3. #include <RF24_config.h>
  4. #include <SPI.h>
  5.  
  6. #define PPM 2
  7.  
  8. const uint64_t pipe = 0xE8E8F0F0E1LL; //Unique address for communication
  9. RF24 radio(9,10); //SPI bus+9,10 pins
  10. int joystick[1]; //variable array to store joystick readings
  11.  
  12.  
  13. void setup()
  14. {  
  15.   pinMode(PPM, INPUT);
  16.  
  17.   radio.begin();
  18.   radio.setPALevel(RF24_PA_MAX); //For Maximum range
  19.   radio.setPayloadSize(10);
  20.   radio.setDataRate(RF24_250KBPS);
  21.   radio.setRetries(15,15);
  22.  
  23.   radio.openWritingPipe(pipe);
  24. }
  25.  
  26. void loop()
  27. {
  28.   int x = digitalRead(PPM);
  29.   joystick[0] = x;
  30.  
  31.   radio.write(joystick, sizeof(joystick));
  32. }
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