Advertisement
HPWebcamAble

Pressure Regulator

May 25th, 2014
1,346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. --[[
  2. PLEASE NOTE!
  3. This was made by me for a server I play on
  4. It is not very good
  5. It requires a specific set up in the world
  6.  
  7. I will probably code another at some point that takes advantage of color screens
  8. ]]
  9.  
  10. oPressure = 2
  11. mPressure = 3
  12.  
  13. function clear()
  14.   term.clear()
  15.   term.setCursorPos(1,1)
  16. end
  17.  
  18. while true do
  19.   clear()
  20.   local cPressure = rs.getAnalogInput("back")/2
  21.   print("Current Pressure:")
  22.   print(cPressure)
  23.   print("Set to turn off at:")
  24.   print(oPressure)
  25.   if cPressure >= oPressure then
  26.     rs.setOutput("right",true)
  27.     print("Compresser is off")
  28.     print("Remaining Coal will continue to burn")
  29.   elseif cPressure < oPressure then
  30.     rs.setOutput("right",false)
  31.     print("Compresser is refilling system...")
  32.   end
  33.   if cPressure >= mPressure then
  34.     rs.setOutput("top",true)
  35.     print("Release valve activated!")
  36.   elseif cPressure < mPressure then
  37.     rs.setOutput("top",false)
  38.   end
  39.   sleep(4)
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement