daily pastebin goal
31%
SHARE
TWEET

bob.lua

a guest Mar 18th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("touchpoint")
  2.  
  3. local t = touchpoint.new("top")
  4.  
  5. t:add("Open", nil, 2, 2, 14, 11, colors.green, colors.lime)
  6. t:add("Close", nil, 16, 2, 28, 11, colors.red, colors.lime)
  7.  
  8. t:draw()
  9.  
  10. while true do
  11.    
  12.     local event, p1 = t:handleEvents(os.pullEvent())
  13.    
  14.     if event == "button_click" then
  15.    
  16.         t:toggleButton(p1)
  17.         if p1 == "Open" then
  18.             rs.setOutput("left", true)
  19.             print("Open Started")
  20.             sleep(20)
  21.             rs.setOutput("left", false)
  22.             print("Open Ended")
  23.        
  24.         elseif p1 == "Close" then
  25.             rs.setOutput("right", true)
  26.             print("Close Started")
  27.             sleep(20)
  28.             print("Close Ended")
  29.             rs.setOutput("right", false)
  30.         end
  31.    end    
  32. 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