From: Olav Bakke Svendsen Date: Tue, 14 May 2024 00:37:29 +0000 (+0200) Subject: Added: vine farm gantry controller X-Git-Tag: skystone~21 X-Git-Url: http://git.olavbs.no/?a=commitdiff_plain;h=54c8b98b7b31c9d884859b6290b7e8a524509874;p=cc.git Added: vine farm gantry controller --- 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