Lua Script Examples (T-Series Devices Only)
While running a Lua script, the T-Series device can operate without computer involvement. Basically, user-specified operations (feedback loops, logging, PID loops) can be conducted via on-board script, which was not possible in previous generations of LabJack hardware. Below is a screenshot of the Lua Scripting section in our free cross-platform program called Kipling.
Kipling's Lua scripting tab is the best way to develop embedded Lua scripts. It simplifies viewing, testing, and configuring Lua scripts. If you are new to Lua Scripting, see you may wish to see Getting Started.
Examples
To view Lua scripts without Kipling, please see our Kipling Git repository. (Our examples are also available in Kipling.) A few select examples have additional information and setup instructions in the subsections that follow this page.
Subsections
Key Feature of Lua Scripting: USER_RAM registers
One common application of Lua Scripts is to execute tasks and export status variables to a logging program. These scripts can use USER_RAM registers to pass data from the Lua script to any other program accessing the T-Series device. LabVIEW, C#, Python, or any other supported languages can access the T-Series device and read from or write to these registers. LJLogM can be used for easy logging of data from the various sensors. Several example scripts like these can be found in the I2C Sensor Examples website section.
One prime example is the Accelerometer & Compass Module (LSM303) example in which a script saves data from the sensor to USER_RAM registers. The USER_RAM registers can then be logged by LJLogM.
More information
More informatio can be found in the Lua Scripting section of the T-Series Datasheet.
Related News Posts
Lua Scripts have been featured in two LabJack news posts: