Skip to content

4. Examples

Carlos Alatorre edited this page Oct 30, 2023 · 7 revisions

On this page, you will find a brief explanation of the examples included in the library.

Basic_LoRaWAN_Beelan

A simple LoRaWAN sketch that uses the CayenneLPP library to send sensor data. The code is written for an Arduino board with an RFM95 LoRa module.

In combination with the Beelan library, this example is able to send random data emulating different sensors such as humidity, temperature, pressure, and battery level to a LoRaWAN service as TTN.

You must set up your LoRaWAN application in order to decode the received information.

Decode & DecodeTTN

The code is a CayenneLPP encoder and decoder. It creates a CayenneLPP package containing a variety of sensor data and then decodes the package into JSON.

The code starts by including the CayenneLPP library and declaring a CayenneLPP object. It then creates a DynamicJsonDocument object to store the decoded JSON data.

In the setup() function, the code adds the sensor data to the CayenneLPP package.

The code then decodes the CayenneLPP package into the DynamicJsonDocument object. Finally, it serializes the JSON data to the console.

This code is useful for debugging CayenneLPP packages or for prototyping applications that use CayenneLPP. It can also be used as a starting point for developing your own CayenneLPP encoder and decoder.