Guest User

control

a guest
Dec 25th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. os.loadAPI("Button")
  2. m = peripheral.wrap("right")
  3. m.clear()
  4.  
  5. function fillTable()
  6.     Button.setTable("LightsOn", LightsOnFunc, 10,20,3,8)
  7.     Button.setTable("LightsOff", LightsOffFunc, 30,40,3,8)
  8.     Button.screen()
  9. end
  10.  
  11. function getClick()
  12.     event,side,x,y = os.pullEvent("monitor_touch")
  13.     Button.checkxy(x,y)
  14. end
  15.  
  16. function LightsOnFunc()
  17.     rs.setOutput("left", false)
  18.     button.toggleButton("LightsOn")
  19.     print("LightsOn")
  20. end
  21.  
  22. function LightsOffFunc()
  23.     rs.setOutput("left", true)
  24.     button.toggleButton("LightsOff")
  25.     print("LightsOff")
  26. end  
  27.  
  28. fillTable()
  29. Button.heading("SpaceShipControl")
  30. Button.label(4,5,"Lights")
  31.  
  32. while true do
  33.     getClick()
  34. end
Advertisement
Add Comment
Please, Sign In to add comment