File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < TheThingsNetwork.h>
2
+ #include < CayenneLPP.h>
3
+
4
+ // Set your AppEUI and AppKey
5
+ const char *appEui = " 0000000000000000" ;
6
+ const char *appKey = " 00000000000000000000000000000000" ;
7
+
8
+ #define loraSerial Serial1
9
+ #define debugSerial Serial
10
+
11
+ // Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
12
+ #define freqPlan REPLACE_ME
13
+
14
+ TheThingsNetwork ttn (loraSerial, debugSerial, freqPlan);
15
+ CayenneLPP lpp (51 );
16
+
17
+ void setup ()
18
+ {
19
+ loraSerial.begin (57600 );
20
+ debugSerial.begin (9600 );
21
+
22
+ // Wait a maximum of 10s for Serial Monitor
23
+ while (!debugSerial && millis () < 10000 )
24
+ ;
25
+
26
+ debugSerial.println (" -- STATUS" );
27
+ ttn.showStatus ();
28
+
29
+ debugSerial.println (" -- JOIN" );
30
+ ttn.join (appEui, appKey);
31
+ }
32
+
33
+ void loop ()
34
+ {
35
+ debugSerial.println (" -- LOOP" );
36
+
37
+ lpp.reset ();
38
+ lpp.addTemperature (1 , 22.5 );
39
+ lpp.addBarometricPressure (2 , 1073.21 );
40
+ lpp.addGPS (3 , 52.37365 , 4.88650 , 2 );
41
+
42
+ // Send it off
43
+ ttn.sendBytes (lpp.getBuffer (), lpp.getSize ());
44
+
45
+ delay (10000 );
46
+ }
You can’t perform that action at this time.
0 commit comments