Advertisement
CdoubleOK

Boiler Monitor

Mar 30th, 2023 (edited)
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | Software | 0 0
  1. local monitor = peripheral.find("monitor")
  2. local modem = peripheral.find("modem")
  3.  
  4. term.clear()
  5. monitor.clear()
  6. monitor.setTextScale(1.0)
  7. monitor.setCursorPos(4,1)
  8. print("Monitor Running...")
  9. monitor.write("Boiler Monitor")
  10.  
  11. local function printStatus(title, channel, line)
  12.     monitor.setCursorPos(4,line)
  13.     monitor.write(title)
  14.     monitor.setCursorPos(4,line + 1)
  15.     monitor.write("Status:")
  16.     modem.open(channel)
  17.     local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  18.     monitor.clearLine()
  19.     monitor.setCursorPos(4,line + 1)
  20.     monitor.write("Status: "..message)
  21.     modem.close(channel)
  22. end
  23.  
  24. while not rs.getInput("back") do
  25.     printStatus("--Boiler #1--", 2, 4)
  26.     printStatus("--Boiler #1 Fuel Feed--", 3,7)
  27.     printStatus("--Boiler #2--", 6,10)
  28.     printStatus("--Boiler #2 Fuel Feed--", 5,13)
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement