Advertisement
iananderson

Untitled

Jun 16th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. p = peripheral.wrap("back")
  2. local monitor = peripheral.wrap("top")
  3.  
  4. term.clear()
  5. monitor.clear()
  6. monitor.setTextScale(0.5)
  7.  
  8. term.setCursorPos(1,1)
  9. monitor.setCursorPos(1,1)
  10.  
  11. write("Enter Setpoint: ")
  12. monitor.write("Enter Setpoint: ")
  13.  
  14. input = tonumber(read())
  15.  
  16.  
  17. if input < 5 or input > 0 then
  18.   term.clear()
  19.   monitor.clear()
  20.  
  21.   term.setCursorPos(1,1)
  22.   monitor.setCursorPos(1,1)
  23.  
  24.   term.write("Setpoint:")
  25.   monitor.write("Setpoint:")
  26.  
  27.   term.write(input)
  28.   monitor.write(input)
  29.  
  30.   term.setCursorPos(1,2)
  31.   monitor.setCursorPos(1,2)
  32.  
  33.   term.write("Pressure:")
  34.   monitor.write("Pressure:")
  35. else
  36.   term.write("Setpoint must be between 0 and 5")
  37.   monitor.write("Setpoint must be between 0 and 5")
  38.   end
  39.  
  40. while true do
  41.   x = p.getPressure()
  42.   y = input
  43.   y1 = input+0.45
  44.  
  45.   term.setCursorPos(1,3)
  46.   monitor.setCursorPos(1,3)
  47.  
  48.   term.write(x)
  49.   monitor.write(x)
  50.  
  51.   sleep(1)
  52.  
  53.   term.clearLine()
  54.   monitor.clearLine()
  55.  
  56.   if x < y then
  57.     rs.setOutput("right",true)
  58.     rs.setOutput("back",false)
  59.  
  60.   elseif x > y1 or x>4.9 then
  61.     rs.setOutput("back",true)
  62.   elseif x > y or x>4.9 then
  63.     rs.setOutput("right",false)
  64.     end
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement