Darknio

Controller Program flo

May 16th, 2025 (edited)
998
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. --local side =peripheral.getNames()
  2. local pneu = peripheral.wrap("back")
  3. local mon = peripheral.wrap("top")
  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,3)
  12.     mon.write("Generator: ")
  13.     mon.setTextColor(color)
  14.     mon.setCursorPos(1,2)
  15.     mon.write(string.format("%.2f",pressure).. "bar")
  16.     mon.setCursorPos(12,3)
  17.     mon.write(status)
  18.     mon.setCursorPos(1,4)
  19.  
  20. end
  21.  
  22. function Auto()
  23.         if pressure > 4.6 then
  24.         rs.setOutput("right",false)
  25.         rs.setOutput("back", false)
  26.         color = colors.red
  27.         status = "off"
  28.     elseif pressure < 3.5 then
  29.         rs.setOutput("right",true)
  30.         rs.setOutput("back", true)
  31.         color = colors.green
  32.         status = "on"
  33.     else
  34.         color = colors.orange  
  35.     end
  36. end
  37.  
  38. while true do
  39. pressure = pneu.getPressure()
  40. Auto()
  41. Anzeige()
  42. sleep(0.5)
  43. end    
Advertisement