1
0
mirror of https://github.com/osmarks/random-stuff synced 2024-11-08 13:39:53 +00:00
random-stuff/computercraft/pressurectrl.lua

16 lines
573 B
Lua
Raw Normal View History

2024-03-29 14:35:43 +00:00
local modem = {peripheral.find("modem", function(_, o) return o.isWireless() end)}
local function send(...)
for _, modem in pairs(modem) do
modem.transmit(48869, 48869, {...})
end
end
local pipe = peripheral.wrap(settings.get "pipe")
local label = settings.get "label"
local ctrl = settings.get "control_output"
local target_pressure = settings.get "target"
while true do
local pressure = pipe.getPressure()
send("pressure/" .. label, "bars of pressure in measured pipe", pressure)
rs.setOutput(ctrl, pressure < target_pressure)
sleep(1)
end