Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.wrap("back")
- local monitor = peripheral.wrap("top")
- term.clear()
- monitor.clear()
- monitor.setTextScale(0.5)
- term.setCursorPos(1,1)
- monitor.setCursorPos(1,1)
- write("Enter Setpoint: ")
- monitor.write("Enter Setpoint: ")
- input = tonumber(read())
- term.setCursorPos(1,5)
- term.write("Press 'X' to cancel")
- monitor.write("Press 'X' to cancel")
- if input < 5 or input > 0 then
- term.clear()
- monitor.clear()
- term.setCursorPos(1,1)
- monitor.setCursorPos(1,1)
- term.write("Setpoint:")
- monitor.write("Setpoint:")
- term.write(input)
- monitor.write(input)
- term.setCursorPos(1,2)
- monitor.setCursorPos(1,2)
- term.write("Pressure:")
- monitor.write("Pressure:")
- else
- term.write("Setpoint must be between 0 and 5")
- monitor.write("Setpoint must be between 0 and 5")
- end
- while true do
- x = p.getPressure()
- y = input
- y1 = input+0.45
- term.setCursorPos(1,3)
- monitor.setCursorPos(1,3)
- term.write(x)
- monitor.write(x)
- sleep(1)
- term.clearLine()
- monitor.clearLine()
- if x < y then
- rs.setOutput("right",true)
- rs.setOutput("back",false)
- elseif x > y1 or x>4.9 then
- rs.setOutput("back",true)
- elseif x > y or x>4.9 then
- rs.setOutput("right",false)
- end
- os.queueEvent("event_marker")
- local breakOut = false
- while true do
- event, key = os.pullEvent()
- if key == keys.x then --add any other events that should break the loop if necessary
- breakOut = true
- elseif key == "event_marker" then
- break
- end
- end
- if breakOut then break end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement