daily pastebin goal
0%
SHARE
TWEET

opengate

a guest Mar 26th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local bool = true
  2. local i = 0
  3. m = peripheral.wrap("left")
  4. function redback(y)
  5.     for i=1, y do
  6.          redstone.setOutput("back",true)
  7.          sleep(1)
  8.          redstone.setOutput("back",false)
  9.          sleep(1)
  10.     end
  11. end
  12. function redtop(y)
  13.     for i=1, y do
  14.          redstone.setOutput("top",true)
  15.          sleep(1)
  16.          redstone.setOutput("top",false)
  17.          sleep(1)
  18.     end
  19. end
  20. function showMonitorON(x, y)
  21.          m.clear()
  22.          m.setCursorPos(x, y)
  23.          m.setTextColor( colors.green )
  24.          m.setTextScale(1.5)
  25.          m.write("ON")
  26. end
  27. function showMonitorOFF(x, y)
  28.          m.clear()
  29.          m.setCursorPos(x, y)
  30.          m.setTextColor( colors.red )
  31.          m.setTextScale(1.5)
  32.          m.write("OFF")
  33. end
  34. while true do
  35.   event, param1, param2 = os.pullEvent("monitor_touch")
  36.   if (event == "monitor_touch") and bool then
  37.        redback(5)
  38.        bool = false
  39.        showMonitorON(1, 2)
  40.   else if (event == "monitor_touch") and not(bool) then
  41.           redtop(5)
  42.           bool = true
  43.           showMonitorOFF(3, 2)
  44.        end
  45.   end
  46. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top