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; //Unique address for communication
- RF24 radio(9,10); //SPI bus+9,10 pins
- int joystick[1]; //variable array to store joystick readings
- void setup()
- {
- pinMode(PPM, INPUT);
- radio.begin();
- radio.setPALevel(RF24_PA_MAX); //For Maximum range
- radio.setPayloadSize(10);
- radio.setDataRate(RF24_250KBPS);
- radio.setRetries(15,15);
- radio.openWritingPipe(pipe);
- }
- void loop()
- {
- int x = digitalRead(PPM);
- joystick[0] = x;
- radio.write(joystick, sizeof(joystick));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement