-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRadio.ino
45 lines (37 loc) · 1.43 KB
/
Radio.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
#include <RFM69.h>
#define NETWORKID 0 // This should really stay 0. DONT CHANGE THIS
#define MYNODEID 147 // Easy to just keep this one and have a dest of two ALWAYS so we can easily determine generated syncword.
#define TONODEID 147 // NOTE - THIS MAY CHANGE TO ENABLE FREQUENCY SHARING
#define FREQUENCY RF69_915MHZ //This translates directly to 915.000 MHz - WARNING: THIS WILL CHANGE IN THE FUTURE
#define USEACK false // Request ACKs or not - NOTE: we will never use ACK's in the competition
void setup_radio()
{
radio.initialize(FREQUENCY, MYNODEID, NETWORKID);
radio.setHighPower();
radio.setPowerLevel(20);
Serial.print("Radio Setup as node: ");
Serial.print(MYNODEID,DEC);
Serial.println();
}
void radio_send() {
static float sendbuffer[14];
static int i;
i = 0;
sendbuffer[i] = millis(); i++;
sendbuffer[i] = myIMU.ax; i++;
sendbuffer[i] = myIMU.ay; i++;
sendbuffer[i] = myIMU.az; i++;
sendbuffer[i] = myIMU.gx; i++;
sendbuffer[i] = myIMU.gy; i++;
sendbuffer[i] = myIMU.gz; i++;
sendbuffer[i] = myIMU.mx; i++;
sendbuffer[i] = myIMU.my; i++;
sendbuffer[i] = myIMU.mz; i++;
sendbuffer[i] = myIMU.temperature; i++;
#if (ARHS)
sendbuffer[i] = myIMU.yaw; i++;
sendbuffer[i] = myIMU.pitch; i++;
sendbuffer[i] = myIMU.roll; i++;
#endif
radio.send(TONODEID, sendbuffer, i * sizeof(*sendbuffer));
}