|
List, The rpi-gpio module is available in the luarocks repository and can be installed (on Raspberry Pi only) using `sudo luarocks install rpi-gpio`. The module provides support for the Raspberry Pi builtin General Purpose Input Output (GPIO) interface, and allows you to create and control electronics projects from Lua. It is a binding to the code of Ben Croston (Python GPIO module) [1], based upon the works of Andre Simon [2] and further extended by me. Where Andres’ Lua binding code only supported basic input output pins, the module
now supports all features of the Python module. - basic input/output pins - PWM support (software based) - edge detection (falling/rising/both) - asynchronous callbacks based on edges Examples [3] for all of these are available in the repo [4] to get going quickly. Not in the python module, and hence not in the Lua binding (a.o.) - I2C - Serial - hardware PWM But I intend to add those as they come available in the Python module The asynchronous callbacks are implemented using darksidesync [5] which is not a rock dependency, so you’ll have to manually install it using `sudo luarocks install darksidesync` (but only if you intend to use callbacks).
See example 6 [6] on how to use those (also requires the ‘copas’ module) Best way for a quick start is through the Lua readme [7] and the examples [3]. Enjoy! And as always comments are welcome! Thijs [1]
http://sourceforge.net/projects/raspberry-gpio-python/ [2]
http://www.andre-simon.de/doku/rpi_gpio_lua/en/rpi_gpio_lua.html [3]
https://github.com/Tieske/rpi-gpio/tree/master/lua/scripts [4]
https://github.com/Tieske/rpi-gpio/ [5]
https://github.com/Tieske/DarkSideSync [6]
https://github.com/Tieske/rpi-gpio/blob/master/lua/scripts/test6_callbacks.lua [7]
https://github.com/Tieske/rpi-gpio/blob/master/lua/README.md |