Advertisement
Guest User

pressureControl

a guest
Jan 24th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. ideal=15
  2.  
  3. local monitor
  4.  
  5. monitor = peripheral.wrap("monitor_3")
  6.  
  7. local pipe
  8.  
  9. pipe = peripheral.wrap("back")
  10.  
  11. while true do
  12.   monitor.clear()
  13.   monitor.setCursorPos(2,3)
  14.   monitor.setTextScale(1)
  15.   monitor.write("Current System Pressure: " .. tostring(math.floor((pipe.getPressure()))))
  16.   print(pipe.getPressure())
  17.   pressure = pipe.getPressure()
  18.   if pressure < ideal then
  19.     rs.setOutput("right",false)
  20.   elseif pressure > ideal then
  21.     rs.setOutput("right",true)
  22.   end
  23.  
  24. os.sleep(5)
  25.  
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement