Advertisement
hypnotizd

Countdown Timer

May 25th, 2014
854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.32 KB | None | 0 0
  1. local countdown = 120
  2. local mon = peripheral.wrap("top")
  3. mon.setTextScale(2)
  4. while countdown > 0 do
  5.   countdown = countdown - 1
  6.   local minutes = math.floor(countdown / 60)
  7.   local seconds = string.format("%02d", countdown % 60)
  8.   mon.clear()
  9.   mon.setCursorPos(1,1)
  10.   mon.write(minutes..":"..seconds)
  11.   os.sleep(1)
  12. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement