Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define the side where the monitor is connected
- local monitorSide = "right" -- Change this to the side where your monitor is connected
- -- Function to initialize the monitor
- local function setupMonitor()
- local monitor = peripheral.wrap(monitorSide)
- monitor.setTextScale(1) -- Adjust text scale if necessary
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.white)
- monitor.clear()
- return monitor
- end
- -- Function to update the time on the monitor
- local function updateTime(monitor)
- while true do
- local time = textutils.formatTime(os.time(), true)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- monitor.write("Current Time: " .. time)
- sleep(1) -- Wait for 1 second before updating the time
- end
- end
- -- Main execution
- local monitor = setupMonitor()
- updateTime(monitor)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement