Program to control a create quarry

This commit is contained in:
Emerson Rosen-Jones 2025-08-09 01:08:47 -04:00
parent 433eff9af9
commit d2ca23d179

44
quarry_control.lua Normal file
View file

@ -0,0 +1,44 @@
local MOVE_DIR = -1
local MINE_DIR = -2
local HEIGHT = 124
local SEQ_SIDE = "back"
local RS_SIDE = "left"
local DIG_MULT = 20
local seq = peripheral.wrap(SEQ_SIDE)
function setMove ()
rs.setOutput(RS_SIDE, false)
end
function setMine ()
rs.setOutput(RS_SIDE, true)
end
function proceed ()
setMove()
seq.move(2, MOVE_DIR)
sleep(1)
while seq.isRunning() do
sleep(1)
end
end
function dig ()
setMine()
seq.move(HEIGHT * DIG_MULT, MINE_DIR)
while seq.isRunning() do
sleep(8)
end
seq.move(HEIGHT, -MINE_DIR)
end
while true do
print("Proceed? [y/N]")
local response = read()
if response == "y" or response == "Y" then
proceed()
end
dig()
end