Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <nRF24L01.h>
- #include <RF24.h>
- #include <RF24_config.h>
- #include <SPI.h>
- #define PPM 2
- const uint64_t pipe = 0xE8E8F0F0E1LL;
- RF24 radio(9,10);
- int joystick[1];
- void setup()
- {
- pinMode(PPM, OUTPUT);
- radio.begin();
- radio.setPALevel(RF24_PA_MAX);
- radio.setPayloadSize(10);
- radio.setDataRate(RF24_250KBPS);
- radio.setRetries(15,15);
- radio.openReadingPipe(1,pipe);
- radio.startListening();;
- }
- void loop()
- {
- if(radio.available())
- {
- bool done=false;
- while(!done)
- {
- done=radio.read(joystick,sizeof(joystick));
- }
- int x = joystick[0];
- digitalWrite(PPM, x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement