Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mouseWidth = 0
- mouseHeight = 0
- p = peripheral.wrap("back")
- monitor = peripheral.wrap("top")
- monitor.clear()
- monitor.setTextScale(0.5)
- monitor.setCursorPos(1,1)
- monitor.write("Setpoint:")
- monitor.setCursorPos(1,2)
- monitor.write("Pressure:")
- monitor.setCursorPos(1,1)
- w,h=monitor.getSize()
- print(w)
- print(h)
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(10,1)
- monitor.write("1")
- monitor.setCursorPos(11,1)
- monitor.write("2")
- monitor.setCursorPos(12,1)
- monitor.write("3")
- monitor.setCursorPos(13,1)
- monitor.write("4")
- monitor.setCursorPos(14,1)
- monitor.write("5")
- monitor.setBackgroundColour((colours.black))
- while true do
- event,side,mouseWidth,mouseHeight = os.pullEvent(monitor_touch)
- if mouseWidth == 10 and mouseHeight == 1 then
- setpoint=1
- print(setpoint)
- end
- if mouseWidth == 11 and mouseHeight == 1 then
- setpoint=2
- print(setpoint)
- end
- if mouseWidth == 12 and mouseHeight == 1 then
- setpoint=3
- print(setpoint)
- end
- if mouseWidth == 13 and mouseHeight == 1 then
- setpoint=4
- print(setpoint)
- end
- if mouseWidth == 14 and mouseHeight == 1 then
- setpoint=5
- print(setpoint)
- end
- x = p.getPressure()
- y = setpoint
- y1 = y+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
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement