Skip to content

Initialization

Chandra Wijaya Sentosa edited this page Jan 12, 2022 · 2 revisions

Initialization

To work with the library, first you must include SX126x header or SX127x header depending LoRa module you use. For LLCC68 include SX126x header. Then initialize class in the header by creating an object. In this documentation LoRa object will be used.

// for SX126x series or LLCC68
#include <SX126x.h>
SX126x LoRa;

// for SX127x series
#include <SX127x.h>
SX127x LoRa;

Begin Library

Before calling any configuration methods, doing transmit or receive operation you must call begin() method to connect to LoRa module.

LoRa.begin()

// configuration, transmit or receive operation code goes here

End Library

After finishing transmit or receive operation you may no longer want to do any operation. At this point you can disconnect from LoRa module by calling end() method. This method will put LoRa module to sleep mode and any modem configuration will lost.

LoRa.end()

Later, if you want to work with library again you must call begin() method and making modem configuration again.