summaryrefslogtreecommitdiff
path: root/mesecons_luacontroller/examples/counter.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2022-01-02 18:42:08 -0600
committercheapie <no-email-for-you@example.com>2022-01-02 18:42:08 -0600
commit243a8063ddbb107ab191aa333cc6cdc85701f410 (patch)
tree848d72cd8b91cc9d259f75196bfd577bd8e88e66 /mesecons_luacontroller/examples/counter.lua
parent648f77bd43f1fbe59e6d655e57d96e2647a43b68 (diff)
downloadmesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.tar
mesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.tar.gz
mesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.tar.bz2
mesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.tar.xz
mesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.zip
Add Luacontroller examples/help system
Diffstat (limited to 'mesecons_luacontroller/examples/counter.lua')
-rw-r--r--mesecons_luacontroller/examples/counter.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/mesecons_luacontroller/examples/counter.lua b/mesecons_luacontroller/examples/counter.lua
new file mode 100644
index 0000000..bbb974c
--- /dev/null
+++ b/mesecons_luacontroller/examples/counter.lua
@@ -0,0 +1,11 @@
+--LCD Counter (requires digilines)
+--Counts the number of pulses sent to pin A and displays the number on an LCD.
+--Connect the LCD over digilines and set the channel to "lcd"
+
+if event.type == "program" then
+ mem.count = 0
+elseif event.type == "on" and event.pin.name == "A" then
+ mem.count = mem.count + 1
+end
+
+digiline_send("lcd",tostring(mem.count))