1
1
#include < TheThingsNetwork.h>
2
2
#include < TheThingsNode.h>
3
3
4
- // These keys are for https://ttn.fyi/activate
5
- // Replace them if you want to use your own app
6
- const char *appEui = " 70B3D57EF0001CEE" ;
7
- const char *appKey = " F2E5C891560FF9CE24AD56E1A69B85DF" ;
4
+ // Set your AppEUI and AppKey
5
+ const char *appEui = " 0000000000000000" ;
6
+ const char *appKey = " 00000000000000000000000000000000" ;
8
7
9
8
#define loraSerial Serial1
10
9
#define debugSerial Serial
11
10
12
11
// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
13
- #define freqPlan REPLACE_ME
12
+ #define freqPlan TTN_FP_EU868
14
13
15
14
TheThingsNetwork ttn (loraSerial, debugSerial, freqPlan);
16
15
TheThingsNode *node;
@@ -24,8 +23,8 @@ void setup() {
24
23
loraSerial.begin (57600 );
25
24
debugSerial.begin (9600 );
26
25
27
- // Test LoRa module
28
- ttn. showStatus ( );
26
+ // Wait a maximum of 10s for Serial Monitor
27
+ while (!debugSerial && millis () < 10000 );
29
28
30
29
// Config Node
31
30
node = TheThingsNode::setup ();
@@ -41,12 +40,6 @@ void setup() {
41
40
node->showStatus ();
42
41
node->setColor (TTN_GREEN);
43
42
44
- // Wait a maximum of 10s for Serial Monitor
45
- while (!debugSerial && millis () < 10000 );
46
-
47
- debugSerial.println (" -- NODE: STATUS" );
48
- node->showStatus ();
49
-
50
43
debugSerial.println (" -- TTN: STATUS" );
51
44
ttn.showStatus ();
52
45
@@ -97,7 +90,7 @@ void sendData(uint8_t port) {
97
90
node->showStatus ();
98
91
99
92
byte* bytes;
100
- byte payload[9 ];
93
+ byte payload[6 ];
101
94
102
95
uint16_t battery = node->getBattery ();
103
96
bytes = (byte*) &battery;
0 commit comments