Advertisement
systox

Datum test

Jul 26th, 2017
4,626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. local monitor
  2. state = false
  3.  
  4. monitor = peripheral.wrap("right")
  5. monitor.setTextScale(3)
  6.  
  7. function Date()
  8.     if fs.exists("date") == true then
  9.         file = fs.open("date", "r")
  10.         f = file.readAll()
  11.             for i in string.gmatch(f, "%S+") do
  12.                 if state == false then
  13.                     monitor.setCursorPos(1,1)
  14.                     monitor.write("Uhrzeit:    ")
  15.                     monitor.write(i)
  16.                     state = true
  17.                 else
  18.                     monitor.setCursorPos(1,2)
  19.                     monitor.write("Datum:      ")
  20.                     monitor.write(i)
  21.                     state = false
  22.                 end
  23.             end
  24.         file.close()
  25.     else
  26.         monitor.write("No date-file found")
  27.     end
  28. end
  29.  
  30. while true do
  31.     monitor.clear()
  32.     monitor.setCursorPos(1,1)
  33.     Date()
  34.     sleep(2)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement