Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- #include <SPI.h>
- #include <nRF24L01.h>
- #include <RF24.h>
- RF24 radio(7, 8);
- Servo rightFlap;
- Servo leftFlap;
- Servo motor;
- Servo back;
- int motorSpeed;
- int flapL;
- int flapR;
- int flapBack;
- int transmit[4];
- const byte address[6] = "00001";
- void setup() {
- Serial.begin(9600);
- rightFlap.attach(5);
- leftFlap.attach(4);
- motor.attach(8, 1000, 2000);
- back.attach(3);
- radio.begin();
- radio.openReadingPipe(0, address);
- radio.setPALevel(RF24_PA_MAX);
- radio.setDataRate(RF24_1MBPS);
- radio.startListening();
- }
- void loop() {
- if (radio.available()) {
- radio.read(&transmit, sizeof(transmit));
- motorSpeed = transmit[0];
- flapL = transmit[1];
- flapR = transmit[2];
- flapBack = transmit[3];
- Serial.println(transmit[1]);
- Serial.println(receve[1]);
- Serial.println(receve[2]);
- Serial.println(receve[3]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement