Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mod = peripheral.wrap("right")
- mod.open(0)
- mon = peripheral.wrap("top")
- mon.setTextColor(colors.cyan)
- local function getDate()
- local request = http.get("http://www.timeapi.org/cet/now?format=%20%25I:%25M:%25S")
- if request then
- local date = request.readAll()
- request.close()
- return date
- else
- return nil
- end
- end
- while true do
- id,message = os.pullEvent("modem_message")
- datum = getDate(date)
- if datum then
- mon.setTextColor(colors.cyan)
- mon.setCursorPos(14,11)
- mon.write(datum)
- else
- mon.setCursorPos(14,11)
- mon.setTextColor(colors.red)
- mon.write("TIMED OUT")
- end
- end
- sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement