Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 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. local w, h = monitor.getSize()
  8.  
  9. -- Add a header
  10. LabelAPI.setHeader('Earth\'s launchpads')
  11.  
  12. -- Add a button
  13. lnch1 = ButtonAPI.new(2, 7, 'Launchpad 1')
  14. lnch2 = ButtonAPI.new(2, 11, 'Launchpad 2')
  15. lnch3 = ButtonAPI.new(2, 15, 'Launchpad 3')
  16.  
  17. btn1 = ButtonAPI.new((w/2)-12, 2, 'Security')
  18.  
  19. lnch1:setBlink(true)
  20. lnch1:setBlinkTime(10)
  21.  
  22. -- Give it a different color, default inactive color is red, default active color is green
  23. btn1:setInactiveColor(colors.blue)
  24. btn1:setActiveColor(colors.purple)
  25.  
  26. -- Give it a callback
  27. -- The button parameter in the callback is the clicked button
  28. btn1:setCallback(function (button)
  29. print('In the callback!')
  30. end)
  31.  
  32. -- Draw all the things!
  33. MonitorAPI.draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement