Advertisement
Nexttozero

Pneumaticraft-ACShutoff

Jan 16th, 2021 (edited)
874
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. ---Monitor Control---
  2. mon = peripheral.wrap("top")
  3. term.redirect(mon)
  4.  
  5. function clearMon()
  6.     term.clear()
  7.     term.setCursorPos(1,1)
  8. end
  9.  
  10. ---Compressor Control---
  11. ac = peripheral.wrap("left")
  12.  
  13. ---Alarm Control---
  14.  
  15. alarmside = "back"
  16.  
  17. function alarmOn()
  18.     redstone.setOutput(alarmside, true)
  19. end
  20.  
  21. function alarmOff()
  22.     redstone.setOutput(alarmside, false)
  23. end
  24.  
  25. -----------
  26.  
  27. while true do
  28.     pressure = ac.getPressure()
  29.     print("CURRENT PRESSURE")
  30.     print(pressure)
  31.    
  32.     if
  33.         pressure > 4.9 then
  34.             redstone.setOutput("left", true)
  35.             alarmOn()
  36.             print("PRESSURE OVERLOAD")
  37.             print("COMPRESSOR DISABLED")
  38.         else
  39.             redstone.setOutput("left", false)
  40.             alarmOff()
  41.             print("PRESSURE RISING")
  42.     end
  43.     sleep(1)
  44.     clearMon()
  45. end    
  46.  
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement