Advertisement
DOGGYWOOF

Untitled

Jul 30th, 2024
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. -- Initialize the peripheral for the monitor
  2. local monitor = peripheral.wrap("top") -- Adjust the side as needed ("top", "bottom", "left", "right", "front", "back")
  3.  
  4. -- Clear the monitor and set the text color
  5. monitor.clear()
  6. monitor.setTextColor(colors.white)
  7. monitor.setBackgroundColor(colors.black)
  8.  
  9. -- Function to display the weather status
  10. local function displayWeatherStatus()
  11. -- Check the redstone signal on the right side
  12. local isRaining = redstone.getInput("right")
  13.  
  14. -- Clear the monitor
  15. monitor.clear()
  16.  
  17. -- Display the weather status
  18. monitor.setCursorPos(1, 1)
  19. monitor.setTextColor(colors.lightGray)
  20. monitor.write("British Weather Report")
  21.  
  22. monitor.setCursorPos(1, 3)
  23. monitor.setTextColor(colors.white)
  24. if isRaining then
  25. monitor.write("It is raining!!")
  26. else
  27. monitor.write("Weather is clear.")
  28. end
  29. end
  30.  
  31. -- Main loop to continually check the redstone signal and update the display
  32. while true do
  33. displayWeatherStatus()
  34. sleep(1) -- Check every second
  35. end
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement