Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Clock
- --By SparkyBearBomb
- function monitorSearch()
- local names = peripheral.getNames()
- local i, name
- for i, name in pairs(names) do
- if peripheral.getType(name) == "monitor" then
- test = name
- return peripheral.wrap(name)
- else
- --return null
- end
- end
- end
- function roundNumber(num, n)
- local mult = 10^(n or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- function heading(text)
- w, h = mon.getSize()
- mon.setCursorPos((w-string.len(text))/2+1, 1)
- mon.write(text)
- end
- mon = monitorSearch()
- while true do
- time = os.time()
- if (time>06.00) and (time<18.00) then
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.green)
- else
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.red)
- end
- mon.setTextScale(5)
- mon.setCursorPos(3,1)
- mon.clear()
- mon.write("00:00")
- mon.setCursorPos(3,1)
- if (time<10.00) then
- mon.write("0")
- end
- time = roundNumber(time, 2)
- mon.write(time)
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement