summaryrefslogtreecommitdiff
path: root/lc_examples/light.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2022-01-07 16:51:04 -0600
committercheapie <no-email-for-you@example.com>2022-01-07 16:51:04 -0600
commit32641893e75f11903489a38a201bd661c8f99b50 (patch)
tree2412538cad02594cf04f7952c8a751c54155fd99 /lc_examples/light.lua
parentee316f2325e26dc532ccaa09369e9d173b5ef411 (diff)
downloaddigistuff-32641893e75f11903489a38a201bd661c8f99b50.tar
digistuff-32641893e75f11903489a38a201bd661c8f99b50.tar.gz
digistuff-32641893e75f11903489a38a201bd661c8f99b50.tar.bz2
digistuff-32641893e75f11903489a38a201bd661c8f99b50.tar.xz
digistuff-32641893e75f11903489a38a201bd661c8f99b50.zip
Add examples for a few devicesHEADmaster
Diffstat (limited to 'lc_examples/light.lua')
-rw-r--r--lc_examples/light.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/lc_examples/light.lua b/lc_examples/light.lua
new file mode 100644
index 0000000..6914167
--- /dev/null
+++ b/lc_examples/light.lua
@@ -0,0 +1,24 @@
+--Digilines Dimmable Light Demo
+
+--Connect one or more lights on the channel "light"
+--Send pulses on:
+----Pin A to make the light brighter
+----Pin B to make the light dimmer
+----Pin C to set the light to full brightness
+----Pin D to turn the light off
+
+if event.type == "program" then
+ mem.light = 0
+elseif event.type == "on" then
+ if event.pin.name == "A" then
+ mem.light = math.min(14,mem.light+1)
+ elseif event.pin.name == "B" then
+ mem.light = math.max(0,mem.light-1)
+ elseif event.pin.name == "C" then
+ mem.light = 14
+ elseif event.pin.name == "D" then
+ mem.light = 0
+ end
+end
+
+digiline_send("light",mem.light)