Advertisement
Dojnaz

CC Monitor Redstone Switch

Dec 15th, 2020
665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. mon = peripheral.wrap("monitor_73")
  2. redstoneSide = "right"
  3.  
  4. --don't change anything under this
  5. local skip = false
  6. local isOpen = false
  7.  
  8. function sleepz()
  9.     sleep(2)
  10. end
  11.  
  12. function touch()
  13.     os.pullEvent("monitor_touch")
  14. end
  15.  
  16. while (true) do
  17.     redstone.setOutput(redstoneSide, isOpen)
  18.     if (isOpen) then
  19.         mon.setBackgroundColor(colors.lime)
  20.     else
  21.         mon.setBackgroundColor(colors.red)
  22.     end
  23.    
  24.     if (skip) then skip = false else isOpen = false end
  25.     mon.clear()
  26.    
  27.     if (parallel.waitForAny(sleepz, touch) == 2) then
  28.         skip = true
  29.         isOpen = true
  30.     end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement