ThingM's blink(1) is a programmable status indicator that plugs into a USB port. This library allows you to control a blink(1) via Lua code.
If you just want a pretty light, it's as simple as:
blink = require 'blink'
d = blink.open()
d:set(255, 123, 147)
This slightly more extensive example toggles the blink between red and blue:
blink = require 'blink'
function doit(d, reps, time)
time = time or 300
for i = 1,reps do
d:red(); blink.sleep(time); d:blue(); blink.sleep(time)
end
d:off()
end
d = blink.open()
doit(d, 4)
As of March 2022, the library has been updated to work with Lua 5.4.2.
The library was developed and tested using Lua 5.2.3. However it should run on other versions of Lua with little or no modification.
It does depend on the Blink1 command line tool. Currently the Makefile
assumes this is already built and, specifically, that the include and dynamic library files are available in /usr/local/include
and /usr/local/lib
respectively. If you have these files in a different directory, you can adjust the Makefile
as appropriate.
Future versions of the build process may handle downloading, building and installing the Blink1 library automatically if it's not currently available. The Makefile
is dependent on GNU Make 4.0 or later.
In a nutshell, here's how to grab, build, and install the software:
git clone https://github.com/profburke/luablink.git
cd luablink/src
make install
Unless you make changes to the software, you won't need to re-generate the documentation, but just in case, use the Makefile
in the top-level directory:
cd ..
make docs
This project uses semantic versioning. See semver.org for more information. See the Changelog for details of the project's evolution. Check the TODO for a list of possible/planned improvements. (TBH the TODO list and Changelog are not current.)
API documentation be found in the doc
subdirectory, the project uses ldoc to generate the documentation.
Help and contributions are encouraged and greatly appreciated!
Code changes, documentation improvement, more examples, ..., a cool logo—there are a wide range of ways you can contribute. A few particular needs are: one or more people to test this software on a Linux machine, help porting to Windows, and help porting to Raspberry Pi.
The best way to contact me regarding this library is to post an issue to the github repository.
Blink is free software distributed under the terms of the MIT license. It may be used for any purpose, including commercial purposes, at absolutely no cost without having to ask us. The only requirement is that if you do use blink, then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. For details, see LICENSE.