summaryrefslogtreecommitdiff
path: root/lc_examples/piston.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/piston.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/piston.lua')
-rw-r--r--lc_examples/piston.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/lc_examples/piston.lua b/lc_examples/piston.lua
new file mode 100644
index 0000000..938acbb
--- /dev/null
+++ b/lc_examples/piston.lua
@@ -0,0 +1,19 @@
+--Digilines Piston Example
+
+--Connect the piston on the channel "piston"
+--Pulse pin A to extend the piston
+--Pulse pin B to retract the piston
+--Pulse pin C to retract the piston, pulling one node back
+--Pulse pin D to silently retract the piston, pulling up to 5 nodes back
+
+if event.type == "on" then
+ if event.pin.name == "A" then
+ digiline_send("piston","extend")
+ elseif event.pin.name == "B" then
+ digiline_send("piston","retract")
+ elseif event.pin.name == "C" then
+ digiline_send("piston","retract_sticky")
+ elseif event.pin.name == "D" then
+ digiline_send("piston",{action = "retract",allsticky = true,max = 5,sound = "none"})
+ end
+end