GrunclePug

Power Status Monitor: Receiver

Jan 29th, 2022
1,079
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. -- This Program retrieves the data from the power
  2. -- plant and displays it on the monitor above
  3. -- Author: moomoocat28
  4.  
  5. -- Pre Initialization
  6. modem = peripheral.wrap("back")
  7. modem.open(250)
  8.  
  9. local monitor = peripheral.wrap("top")
  10. monX, monY = monitor.getSize()
  11.  
  12. -- Initialization
  13. local title = "Power Status Monitor:"
  14. local lineBreak = "---------------------"
  15.  
  16. monitor.setBackgroundColor(colours.green)
  17. monitor.clear()
  18. monitor.setTextScale(1)
  19.  
  20. -- Program
  21. while true do
  22.     event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  23.     monitor.setCursorPos(1,1)
  24.     monitor.write(title)
  25.    
  26.     monitor.setCursorPos(1,2)
  27.     monitor.write(lineBreak)
  28.    
  29.     monitor.setCursorPos(1,3)
  30.     monitor.write("Status: ONLINE")
  31.    
  32.     monitor.setCursorPos(1,5)
  33.     monitor.write("EU:")
  34.    
  35.     monitor.setCursorPos(1,6)
  36.     monitor.write(message[1])
  37.    
  38.     monitor.setCursorPos(1,8)
  39.     monitor.write("RF:")
  40.    
  41.     monitor.setCursorPos(1,9)
  42.     monitor.write(message[2])
  43.    
  44.     monitor.setCursorPos(1, monY)
  45.     monitor.write("Created by moomoocat28")
  46.     sleep(1)
  47. end
Advertisement
Add Comment
Please, Sign In to add comment