Skip to content

Commit 8c311ea

Browse files
committed
CayenneLPP example
1 parent 1718c4e commit 8c311ea

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

examples/CayenneLPP/CayenneLPP.ino

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
}

0 commit comments

Comments
 (0)