Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# load the Touchpoint API
- loadup = function()
- shell.run("pastebin", "get", "pFHeia96", "touchpoint")
- os.loadAPI("touchpoint")
- print("Touchpoint API Loaded")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- end
- loadup()
- function rson()
- rs.setOutput("top", true)
- end
- function rsoff()
- rs.setOutput("top", false)
- end
- local t = touchpoint.new("front")
- t:add("Lights", nil, 1, 1, 7, 1, colors.black, colors.black)
- t:add("OFF", nil, 2, 2, 6, 4, colors.red, colors.lime)
- t:draw()
- while true do
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- t:toggleButton(p1)
- if p1 == "OFF" then
- t:rename("OFF", "ON")
- rson()
- elseif p1 == "ON" then
- t:rename("ON", "OFF")
- rsoff()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement