-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_receiver_8ch.ino
50 lines (44 loc) · 993 Bytes
/
test_receiver_8ch.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include<SPI.h>
#include<nRF24L01.h>
#include<RF24.h>
const uint64_t pipeOut = 1234;
RF24 radio(9, 10);//CSN pins
struct Data{
int throttle;
int yaw;
int pitch;
int roll;
byte AUX1;
byte AUX2;
byte AUX3;
byte AUX4;
}data;
void setup() {
Serial.begin(9600);
radio.begin();
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.openWritingPipe(pipeOut);
radio.startListening();
}
void loop() {
while ( radio.available() ) {
radio.read(&data, sizeof(Data));
Serial.print("\n");
Serial.print(data.throttle);
Serial.print("\t");
Serial.print(data.yaw);
Serial.print("\t");
Serial.print(data.pitch);
Serial.print("\t");
Serial.print(data.roll);
Serial.print("\t");
Serial.print(data.AUX1);
Serial.print("\t");
Serial.print(data.AUX2);
Serial.print("\t");
Serial.print(data.AUX3);
Serial.print("\t");
Serial.print(data.AUX4);
}
}