Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initialize the peripheral for the monitor
- local monitor = peripheral.wrap("top") -- Adjust the side as needed ("top", "bottom", "left", "right", "front", "back")
- -- Clear the monitor and set the text color
- monitor.clear()
- monitor.setTextColor(colors.white)
- monitor.setBackgroundColor(colors.black)
- -- Function to display the weather status
- local function displayWeatherStatus()
- -- Check the redstone signal on the right side
- local isRaining = redstone.getInput("right")
- -- Clear the monitor
- monitor.clear()
- -- Display the weather status
- monitor.setCursorPos(1, 1)
- monitor.setTextColor(colors.lightGray)
- monitor.write("British Weather Report")
- monitor.setCursorPos(1, 3)
- monitor.setTextColor(colors.white)
- if isRaining then
- monitor.write("It is raining!!")
- else
- monitor.write("Weather is clear.")
- end
- end
- -- Main loop to continually check the redstone signal and update the display
- while true do
- displayWeatherStatus()
- sleep(1) -- Check every second
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement