Skip to main content
Version: 2.13.0

Common

api.ledControl(state)

Turns ON or OFF the on board LED. It can be also used for debugging purposes.

api.delayms(ms,mode)

Pause the execution for ms milliseconds.

api.randInt(min, max)

Generate random number within given range.

Available only for LoRaWAN devices (function uses it's module to generate random number)

api.getUniqueNumber()

Calling this function increases uint32_t variable by one every time this function is called then it returns it's value. It's in range (in range from 0 to 2^32)*

api.getBatteryVoltage()

Get curent battery voltage in mV.

api.getTick(int)

Returns current number of milliseconds since startup. Counts up to 2^32 and then restarts from 0. By default it's using RTC derived tick which is incremented during sleep, but it's possible to explicitly select systick, which isn't.

api.dumpArray(str)

Prints contents of variable as hexadecimal string (dumps array into console)

api.float(op,form,arg1,arg2)

Performs operation with given floating point data.

Only if it's allowed by the firmware. Convert function available from FW version v2.5.1

api.setVar(index, value, bool)

Saves a persistent variable value, can be used between different wake up iterations.

api.getVar(index)

Returns persistent variable value, can be used between different wake up iterations.

api.wakeUpAt(day, hour, minute, second)

Schedules the next wake up event of the device to provided day of month (day), hour, minute and second. The provided wake up date is therefore absolute and not relative as in wakeUpIn().

api.wakeUpIn(day, hour, minute, second)

Schedules the next wake up event of the device after specified time interval. The provided wake up date is therefore relative and not absolute as in wakeUpAt(). Note: The input arguments are not limited, but the total period specified must not exceed 31 days. (e.g. hour = 40, days = 2 gives a period of 3 days and 16 hours).

api.getTimeDate()

Returns current date and time set on this device. The time can be synchronized over LoRa, or when uploading LUA script using LUA scripting interface.

api.setTimeDate(...)

Set date and time on this device, or calculate the difference and synchronize the date and time using first argument "DIFF" (detail in Arguments).

api.voltageSourceState(state, voltage)

Turn ON/OFF voltage source

Only for variants with voltage source.

The voltage option is available only for variant with adjustable option.

api.stdin(option, opt1, opt2, opt3)

Read stdin (standard input) data or control button (get status, wait for button).

This function is using serial line, therefore use of this function in an interactive console (GUI) is not possible.

api.stdout(out, size, offset)

Write to stdout (standard output) without adding line termination. Can be useful when implementing raw serial protocols.

api.bsprintf(binData, format, offset, endian)

Function for formatting binary stream data according to various format specifiers, including support for characters, integers, short and long integers, floats, and doubles.

api.setVerbosity(num, opt)

Controls the amount of prints into the serial line.

api.exec(command, arg1, arg2, ...)

Executes a system command or Lua fragment (additionaly uploaded Lua API extension, according to https://ieeexplore.ieee.org/document/8733437)

api.table(command, arg1, arg2, ...)

Interface to create and manipulate memory-efficient tables and maps. Check multimode script or sendOnce script for example usage.