Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Multi-touch.lua

a guest Jul 12th, 2018 55 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. mon = peripheral.wrap("right")
  2. rednet.open("top")
  3.  
  4. --setup
  5.     mon.setTextScale(1)
  6.    
  7. --pre start
  8.     mon.setBackgroundColor(colors.black)
  9.     mon.clear()
  10.  
  11. function off_text(c,r)
  12.     mon.setCursorPos(c,r)
  13.     mon.setTextColor(colors.white)
  14.     mon.setBackgroundColor(colors.red)
  15.     mon.write("Off")
  16. end
  17. function on_text(c,r)
  18.     mon.setCursorPos(c,r)
  19.     mon.setTextColor(colors.white)
  20.     mon.setBackgroundColor(colors.lime)
  21.     mon.write("On ")
  22. end
  23.  
  24. -- Button 1
  25. while true do
  26.     off_text(2,2)
  27.     event, side, x, y = os.pullEvent("monitor_touch")
  28.         if x + 1 > 2 and x < 5 and y == 2 then
  29.             on_text(2,2)
  30.             if os.pullEvent("monitor_touch") then
  31.             end
  32.         end
  33. 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