Common
General Functions
This category contains functions that are used for all devices.
| API Name | Brief Description |
|---|---|
| api.ledControl(state, timeout, period, offState, pattern, Ts, patternTimeout) | Turns ON or OFF the on board LED. |
| api.delayms(ms,mode) | Pauses the execution for ms milliseconds. |
| api.randInt(min, max) | Generates random number within given range. |
| api.getUniqueNumber() | Generates unique number. |
| api.getBatteryVoltage() | Returns the current voltage level of the battery in mV. |
| api.getTick(clock, reset) | Returns current number of milliseconds since startup. |
| api.dumpArray(str,opt) | Prints contents of variable as hexadecimal string (dumps array into console). |
| api.float() | Performs operation with given floating point data. Multiple variants. See below. |
| api.setVar() | Saves a persistent variable value. Multiple variants. See below. |
| api.getVar() | Returns persistent variable value. Multiple variants. See below. |
| api.wakeUpAt(day, hour, minute, second, resetOnFail) | Schedules the next wake up event of the device to provided day of month, hour, minute and second. |
| api.wakeUpIn(day, hour, minute, second, resetOnFail, milisecond) | Schedules the next wake up event of the device after specified time interval. |
| api.getTimeDate(timezoneShift) | Returns current date and time set on this device. |
| api.setTimeDate() | Set date and time on this device, or calculate the difference and synchronize the date and time. Multiple variants. See below. |
| api.voltageSourceState() | Controls voltage source. Multiple variants. See below. |
| api.stdin() | Reads stdin (standard input) data or control button (get status, wait for button). Multiple variants. See below. |
| api.stdout(out, size, offset) | Writes to stdout (standard output) without adding line termination. |
| api.bsprintf(binData, format, offset, endian) | Formats binary stream data according to various format specifiers, including support for characters, integers, short and long integers, floats, and doubles. |
| api.setVerbosity() | Controls the number of messages printed to the serial line. Multiple variants. See below. |
| api.exec() | Executes a system command or Lua fragment. Multiple variants. See below. |
| api.table() | Interface to create and manipulate memory-efficient tables and maps. Multiple variants. See below. |
| api.aes(operation, data, iv, key) | Encrypts or decrypts provided payload using a key and IV with AES-CTR. |
api.ledControl(state, timeout, period, offState, pattern, Ts, patternTimeout)
api.ledControl(1) --turn on the LED
Controls the device’s blue LED. Supports solid on/off, duty-cycled blinking via (timeout, period), and custom patterns with optional timeouts.