Guest User

Simple Clock

a guest
Dec 29th, 2012
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.37 KB | None | 0 0
  1. mon = peripheral.wrap("top")
  2. mon.setTextScale(4)
  3. x = 0 -- x is seconds
  4. y = 0 -- y is minutes
  5. z = 0 -- z is hours
  6. while true do
  7.   mon.clear()
  8.   mon.setCursorPos(1, 1)
  9.   mon.print(z..":"..y..":"..x)
  10.   sleep(1)
  11.   x = x + 1
  12.   if x == 60 then
  13.     x = 0
  14.     y = y + 1
  15.   end
  16.   if y == 60 then
  17.     y = 0
  18.     z = z + 1
  19.     if z == 24 then
  20.       z = 0
  21.     end
  22.   end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment