Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# load the Touchpoint API
- os.loadAPI("touchpoint")
- p = peripheral.wrap("back")
- --# FUNCTIONS
- function peat()
- p.setFreq(151)
- end
- function peat2()
- p.setFreq(222)
- end
- --# intialize a new button set on the top monitor
- local t = touchpoint.new("top")
- --# add buttons
- t:add("label", nil, 2, 2, 14, 11, colors.red, colors.lime)
- t:add("Power", nil, 16, 2, 28, 11, colors.lime, colors.red)
- --# draw the buttons
- t:draw()
- while true do
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- t:toggleButton(p1)
- if p1 == "label" then
- peat()
- else
- peat2()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment