Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- API = require("buttonAPI")
- local event = require("event")
- local computer = require("computer")
- local term = require("term")
- local component = require("component")
- local gpu = component.gpu
- local rs = component.redstone
- local colors = require("colors")
- local sides = require("sides")
- function API.fillTable()
- API.setTable("Hall", test1, 10,30,3,5)
- API.setTable("Entrance", test2, 32,52,3,5)
- API.setTable("Stall lights", test3, 10,30,8,10)
- API.setTable("Stall power", test4, 32,52,8,10)
- API.screen()
- end
- function getClick()
- local _, _, x, y = event.pull(1,touch)
- if x == nil or y == nil then
- local h, w = gpu.getResolution()
- gpu.set(h, w, ".")
- gpu.set(h, w, " ")
- else
- API.checkxy(x,y)
- end
- end
- function test1()
- API.toggleButton("Hall")
- if buttonStatus == true then
- term.setCursor(1,25)
- term.write("Working... ")
- rs.setOutput(sides.left,15)
- os.sleep(1)
- term.setCursor(1,25)
- term.write("System ready ")
- else
- term.setCursor(1,25)
- term.write("Working... ")
- rs.setOutput(sides.left,0)
- os.sleep(1)
- term.setCursor(1,25)
- term.write("System ready ")
- end
- end
- function test2()
- API.toggleButton("Entrance")
- if buttonStatus == true then
- term.setCursor(1,25)
- term.write("Working... ")
- rs.setOutput(sides.up,15)
- os.sleep(1)
- term.setCursor(1,25)
- term.write("System ready ")
- else
- term.setCursor(1,25)
- term.write("Working... ")
- rs.setOutput(sides.up,0)
- os.sleep(1)
- term.setCursor(1,25)
- term.write("System ready ")
- end
- end
- function test3()
- API.toggleButton("Stall lights")
- if buttonStatus == true then
- term.setCursor(1,25)
- term.write("Working... ")
- rs.setOutput(sides.right,15)
- os.sleep(1)
- term.setCursor(1,25)
- term.write("System ready ")
- else
- term.setCursor(1,25)
- term.write("Working... ")
- rs.setOutput(sides.right,0)
- os.sleep(1)
- term.setCursor(1,25)
- term.write("System ready ")
- end
- end
- function test4()
- API.toggleButton("Stall power")
- if buttonStatus == true then
- term.setCursor(1,25)
- term.write("Working... ")
- rs.setOutput(sides.back,15)
- os.sleep(1)
- term.setCursor(1,25)
- term.write("System ready ")
- else
- term.setCursor(1,25)
- term.write("Working... ")
- rs.setOutput(sides.back,0)
- os.sleep(1)
- term.setCursor(1,25)
- term.write("System ready ")
- end
- end
- term.setCursorBlink(false)
- gpu.setResolution(80, 25)
- API.clear()
- API.fillTable()
- API.heading("Power control - by maumagro")
- API.label(1,24,"Buenos Aires, Argentina.")
- while true do
- getClick()
- end
- --eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement