TTGO LORA32 868Mhz - CayenneLPP

Hi Guys

Please can I get some assistance.
I would like to integrate Cayenne LPP onto my TTGO LORA32.
In The below code I need to modify Serial1.

Link to the product:
https://www.banggood.com/2Pcs-LILYGO-TTGO-LORA32-868Mhz-ESP32-LoRa-OLED-0_96-Inch-Blue-Display-bluetooth-WIFI-ESP-32-Development-Board-Module-With-Antenna-p-1507044.html?rmmds=search&cur_warehouse=CN

#include <TheThingsNetwork.h>
#include <CayenneLPP.h>

// Set your AppEUI and AppKey
const char appEui = "************************";
const char *appKey = “**************************”;

#define loraSerial Serial1
#define debugSerial Serial

// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_EU868

TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
CayenneLPP lpp(51);

void setup()
{
loraSerial.begin(57600);
debugSerial.begin(9600);

// Wait a maximum of 10s for Serial Monitor
while (!debugSerial && millis() < 10000)
;

debugSerial.println("-- STATUS");
ttn.showStatus();

debugSerial.println("-- JOIN");
ttn.join(appEui, appKey);
}

void loop()
{
debugSerial.println("-- LOOP");

lpp.reset();
lpp.addTemperature(1, 22.5);
lpp.addBarometricPressure(2, 1073.21);
lpp.addGPS(3, 52.37365, 4.88650, 2);

// Send it off
ttn.sendBytes(lpp.getBuffer(), lpp.getSize());

delay(10000);
}

you will need to use code similar to this https://github.com/ElectronicCats/CayenneLPP/blob/master/examples/WeatherStation_LMIC/WeatherStation_LMIC.ino

Thank you Shramik, I got it working :slight_smile:

2 Likes