Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Load the API
- os.loadAPI('MonitorAPI')
- -- Attach a monitor
- local monitor = peripheral.wrap('monitor_0')
- MonitorAPI.setMonitor(monitor)
- local w, h = monitor.getSize()
- -- Add a header
- LabelAPI.setHeader('Earth\'s launchpads')
- -- Add a button
- lnch1 = ButtonAPI.new(2, 7, 'Launchpad 1')
- lnch2 = ButtonAPI.new(2, 11, 'Launchpad 2')
- lnch3 = ButtonAPI.new(2, 15, 'Launchpad 3')
- btn1 = ButtonAPI.new((w/2)-12, 2, 'Security')
- lnch1:setBlink(true)
- lnch1:setBlinkTime(10)
- -- Give it a different color, default inactive color is red, default active color is green
- btn1:setInactiveColor(colors.blue)
- btn1:setActiveColor(colors.purple)
- -- Give it a callback
- -- The button parameter in the callback is the clicked button
- btn1:setCallback(function (button)
- print('In the callback!')
- end)
- -- Draw all the things!
- MonitorAPI.draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement