Advertisement
MagmaLP

Namensloser Touchscreen

Jan 10th, 2023 (edited)
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. mon = peripheral.wrap("back")
  2. mon.setTextScale(5)
  3. mon.clear()
  4.  
  5. file = fs.open("status", "r")
  6. local inhalt = file.readLine()
  7. file.close()
  8.  
  9. if inhalt == "aus" then
  10.     rs.setOutput("bottom", true)
  11.     mon.setCursorPos(1,1)
  12.     mon.setBackgroundColor(16384)
  13.     mon.write(" ")
  14.     print(1)
  15. elseif inhalt == "an" then
  16.     rs.setOutput("bottom", false)
  17.     mon.setCursorPos(1,1)
  18.     mon.setBackgroundColor(32)
  19.     mon.write(" ")
  20.     print(2)
  21. end
  22.  
  23. while true do
  24.     local event, side, X, Y = os.pullEvent("monitor_touch")
  25.     if X == 1 and Y == 1 and side == "back" and inhalt == "aus" then
  26.         file = fs.open("status", "w")
  27.         file.write("an")
  28.         file.close()
  29.         shell.run("startup")
  30.         print(3)
  31.     elseif X == 1 and Y == 1 and side == "back" and inhalt == "an" then
  32.         file = fs.open("status", "w")
  33.         file.write("aus")
  34.         file.close()
  35.         shell.run("startup")
  36.         print(4)
  37.     end
  38.     sleep(0.5)
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement