Advertisement
jfmachine

test

May 23rd, 2023
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local monitor = peripheral.wrap("back")
  2.  
  3. function printCursPos()
  4.     print(monitor.getCursorPos())
  5. end
  6.  
  7. monitor.setTextScale(5)
  8. while true do
  9. monitor.setCursorPos(1,1)
  10. time = os.time()
  11. min = time % 1
  12. hour = time - min
  13. min = min * 60
  14. min = min - (min % 1)
  15. hourtxt = "" .. hour
  16. ampm = "AM"
  17. if hour > 11 then
  18.     ampm = "PM"
  19. end
  20. if hour > 12 then
  21.     hour = hour - 12
  22.     hourtxt = "" .. hour
  23. end
  24. if hour < 10 then
  25.     hourtxt = " " .. hourtxt
  26. end
  27. if hour == 0 then
  28.     hourtxt = "" .. 12
  29. end
  30. mintxt = "" .. min
  31. if min < 10 then
  32.     mintxt = "0" .. mintxt
  33. end
  34. monitor.write(hourtxt .. ":" .. mintxt .. " " .. ampm)
  35. sleep(0.1)
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement