Skip to content

Library for Arduino compatible with Cayenne Low Power Payload

License

Notifications You must be signed in to change notification settings

ryanlath/CayenneLPP

 
 

Repository files navigation

CayenneLPP

This is an Arduino Library that implements a version of the Cayenne Low Power Payload for my use in low power radios like the RFM69 radio communication. It is NOT intended for TTN (or Cayenne for that matter). It varies in that there is one "channel" per payload, in my case, the "node id." It also adds the "Voltage" format.

It encodes. It decodes to JSON via ArduinoJson.

Documentation

See code and examples.

##Examples

  • Encode
CayenneLPP lpp(NODEID);

lpp.reset();
lpp.addVoltage(3.028);
lpp.addTemperature(73.2);
lpp.addBarometricPressure(1073.21);
uint8_t len = lpp.getSize();
uint8_t *buff = (uint8_t *)malloc(len);
lpp.copy(buff);
  
// e.g. send it somewhere
radio.sendWithRetry(GATEWAYID, buff, len, 1);
  
free(buff);
  • Decode
CayenneLPPDecode lppd;

StaticJsonBuffer<200> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();

// e.g. "you know you can't live without your radio"
lppd.write((uint8_t*)radio.DATA, radio.DATALEN);
lppd.decode(root);
root["rssi"] = radio.RSSI;

Serial.print(radio.NODEID);
root.printTo(Serial);
Serial.println();
lppd.reset();

##Credits

About

Library for Arduino compatible with Cayenne Low Power Payload

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%