Darknio

Pneumatic Craft Monitoring

May 16th, 2025 (edited)
1,104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. --local side =peripheral.getNames()
  2. local pneu = peripheral.wrap("bottom")
  3. local mon = peripheral.wrap("back")
  4.  
  5.  
  6. function Anzeige()
  7.     mon.setTextColor(colors.white)
  8.     mon.clear()
  9.     mon.setCursorPos(1,1)
  10.     mon.write("Aktueller Durck:")
  11.     mon.setCursorPos(1,5)
  12.     mon.write("Generator: ")
  13.     --mon.setCursorPos(1,4)
  14.    -- mon.write("Luftmenge: ")
  15.     mon.setTextColor(color)
  16.     mon.setCursorPos(1,2)
  17.     mon.write(string.format("%.2f",pressure).. "bar")
  18.     mon.setCursorPos(12,5)
  19.     mon.write(status)
  20.  --   mon.setCursorPos(1,4)
  21.  
  22. end
  23.  
  24. function Auto()
  25.         if pressure > 4.6 then
  26.         rs.setOutput("bottom",false)
  27.         rs.setOutput("left",false)
  28.         color = colors.red
  29.         status = "off"
  30.     elseif pressure < 4.0 then
  31.         rs.setOutput("bottom",true)
  32.         rs.setOutput("left",true)
  33.         color = colors.green
  34.         status = "on"
  35.     else
  36.         if pressure > 4.6 then
  37.             status = "off"
  38.         else
  39.             status = "on"
  40.         end
  41.         color = colors.orange  
  42.     end
  43. end
  44.  
  45. while true do
  46. pressure = pneu.getPressure()
  47. -- air = pneu.getAir()
  48. Auto()
  49. Anzeige()
  50. sleep(0.5)
  51. end    
Advertisement