people
i am a begginner on lorawan, and connected my heltec lora, with TTN, and this work well, decoder packet with payload decoder LPP, and everthing work fine, until try sen data to cayenne server with LPP, so this did not appear, please see what i am use, and please anybody can say me what i am doing wrong
my code:
#include <TTN_esp32.h>
#include “TTN_CayenneLPP.h”
/***************************************************************************
- Go to your TTN console register a device then the copy fields
- and replace the CHANGE_ME strings below
*************************************************************************/
const char devEui = “CHANGE_ME”; // Change to TTN Device EUI
const char appEui = “CHANGE_ME”; // Change to TTN Application EUI
const char appKey = “CHANGE_ME”; // Chaneg to TTN Application Key
TTN_esp32 ttn ;
TTN_CayenneLPP lpp;
void message(const uint8_t* payload, size_t size, int rssi)
{
Serial.println(“-- MESSAGE”);
Serial.print(“Received " + String(size) + " bytes RSSI=” + String(rssi) + “db”);
for (int i = 0; i < size; i++)
{
Serial.print(" " + String(payload[i]));
// Serial.write(payload[i]);
}
Serial.println();
}
void setup()
{
Serial.begin(115200);
Serial.println(“Starting”);
ttn.begin();
ttn.onMessage(message); // Declare callback function for handling downlink
// messages from server
ttn.join(devEui, appEui, appKey);
Serial.print(“Joining TTN “);
while (!ttn.isJoined())
{
Serial.print(”.”);
delay(500);
}
Serial.println(“\njoined !”);
ttn.showStatus();
}
void loop()
{
static float nb = 18.2;
nb += 0.1;
lpp.reset();
lpp.addTemperature(1, nb);
if (ttn.sendBytes(lpp.getBuffer(), lpp.getSize()))
{
Serial.printf(“Temp: %f TTN_CayenneLPP: %d %x %02X%02X\n”, nb, lpp.getBuffer()[0], lpp.getBuffer()[1],
lpp.getBuffer()[2], lpp.getBuffer()[3]);
}
delay(10000);
}
pictures:
thanks a lot for help!!
CDV