Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. -- Load the API
  2. os.loadAPI('MonitorAPI')
  3.  
  4. -- Attach a monitor
  5. local monitor = peripheral.wrap('monitor_0')
  6. MonitorAPI.setMonitor(monitor)
  7.  
  8. -- Add a header
  9. LabelAPI.setHeader('Earth\'s launchpads')
  10.  
  11. -- Add a button
  12. lnch1 = ButtonAPI.new(2, 7, 'Launchpad 1')
  13. lnch2 = ButtonAPI.new(2, 11, 'Launchpad 2')
  14. lnch3 = ButtonAPI.new(2, 15, 'Launchpad 3')
  15.  
  16. btn1 = ButtonAPI.new(5, 2, 'Security')
  17.  
  18. lnch1:setBlink(true)
  19.  
  20. -- Give it a different color, default inactive color is red, default active color is green
  21. btn1:setInactiveColor(colors.blue)
  22. btn1:setActiveColor(colors.purple)
  23.  
  24. -- Give it a callback
  25. -- The button parameter in the callback is the clicked button
  26. btn1:setCallback(function (button)
  27. print('In the callback!')
  28. end)
  29.  
  30. -- Draw all the things!
  31. MonitorAPI.draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement