local computer = require("computer") local rs = require("component").redstone local sides = require("sides") local lastPowerValue = -1 local compressorState = false local cutValue = 8 print("The cut value is fixed at " .. cutValue .. ". At this value, it will automatically stop compressor.") while true do local power = rs.getInput(sides.back) if power ~= lastPowerValue then lastPowerValue = power print("[" .. os.date():sub(9) .. "]" .. " Current redstone value: " .. power .. "/16.0 (" .. power / 2 .. "BAR +-)") end if (power < cutValue) then rs.setOutput(sides.left, 14) if compressorState ~= true then print("[" .. os.date():sub(9) .. "]" .. " Turning ON compressor...") compressorState = true computer.beep() end else rs.setOutput(sides.left, 0) if compressorState ~= false then print("[" .. os.date():sub(9) .. "]" .. " Turning OFF compressor...") compressorState = false computer.beep() end end os.sleep(2) end