From 32641893e75f11903489a38a201bd661c8f99b50 Mon Sep 17 00:00:00 2001 From: cheapie Date: Fri, 7 Jan 2022 16:51:04 -0600 Subject: Add examples for a few devices --- lc_examples/button.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lc_examples/button.lua (limited to 'lc_examples/button.lua') diff --git a/lc_examples/button.lua b/lc_examples/button.lua new file mode 100644 index 0000000..951d45a --- /dev/null +++ b/lc_examples/button.lua @@ -0,0 +1,18 @@ +--Digilines Button Example + +--Connect a button on the channel "button" with any message. +--When the button is pressed, pin A will toggle. +--If manual light control is selected on the button, the button light will also be flashing. +--If the button has a message set, it will be sent to an LCD on channel "lcd" + +if event.type == "program" then + mem.flash = false + interrupt(0,"flash") +elseif event.iid == "flash" then + mem.flash = not mem.flash + digiline_send("button","light_"..(mem.flash and "on" or "off")) + interrupt(1,"flash",true) +elseif event.channel == "button" then + port.a = not port.a + digiline_send("lcd",event.msg) +end -- cgit v1.2.3