Skip to content

Initialization

Chandra Wijaya Sentosa edited this page Jan 12, 2022 · 1 revision

Initialization

To work with the library, first you must import SX126x python module. Then initialize the library by creating an object from those module. In this documentation LoRa object will be used.

from LoRaRF import SX126x
LoRa = SX126x()

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.