From 54c8b98b7b31c9d884859b6290b7e8a524509874 Mon Sep 17 00:00:00 2001 From: Olav Bakke Svendsen Date: Tue, 14 May 2024 02:37:29 +0200 Subject: [PATCH] Added: vine farm gantry controller --- vines/gantry-harvester.lua | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 vines/gantry-harvester.lua diff --git a/vines/gantry-harvester.lua b/vines/gantry-harvester.lua new file mode 100644 index 0000000..6529a25 --- /dev/null +++ b/vines/gantry-harvester.lua @@ -0,0 +1,43 @@ +-- xy gantry with deployer and shears + +-- timings +-- works with 64 RPM +local vertical_tick = 0.5 +local horizontal_time = 4.5 +local stanby_time = 60*30 +local rows = 10 + +-- redstone IO +local enable = "front" -- input: true -> enable +local y_gearshift = "left" -- output: true -> move home +local y_clutch = "top" -- output: true -> disengage + +local reset = function() + for _, out in pairs({y_gearshift, y_clutch}) do + rs.setOutput(out, false) + end +end + +local up = function() + rs.setOutput(y_gearshift, true) + rs.setOutput(y_clutch, false) + os.sleep(vertical_tick) + rs.setOutput(y_cluctch, true) +end + +local harvest = function() + for i = 1, rows-1 do + up() + os.sleep(horizontal_time) + end + reset() +end + +while true do + if rs.getInput(enable) then + harvest() + os.sleep(standby_time) + else + os.pullEvent("redstone") + end +end -- 2.30.2