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 pulse()
- redstone.setOutput("back", true)
- sleep(0,5)
- redstone.setOutput("back", false)
- end
- function peat()
- p.setFreq(151)
- pulse()
- end
- function pumpkin()
- p.setFreq(152)
- pulse()
- end
- function melon()
- p.setFreq(153)
- pulse()
- end
- --# intialize a new button set on the top monitor
- local t = touchpoint.new("top")
- --# add buttons
- t:add("PEAT", nil, 2, 2, 16, 4, colors.red, colors.lime)
- --t:add("PUMPKIN", nil, 2, 2, 28, 11, colors.lime, colors.red)
- --t:add("MELON", nil, 2, 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 == "PEAT" then
- peat()
- --elseif p1 == "PUMPKIN" then
- -- pumpkin()
- else
- melon()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment