Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- button = require("buttonAPI")
- local event = require("event")
- local computer = require("computer")
- local term = require("term")
- local component = require("component")
- local gpu = component.gpu
- function fillTable()
- setTable("Flash", test1, 10,20,3,5)
- setTable("Toggle", test2, 22,32,3,5)
- setTable("Free Ram", test3, 10,20,8,10)
- setTable("Reboot", test4, 22,32,8,10)
- screen()
- end
- function getClick()
- local _, _, x, y = event.pull(touch)
- checkxy(x,y)
- end
- function test1()
- flash("Flash",0.01) -- flash(ButtonName,Duration)
- end
- function test2()
- toggleButton("Toggle")
- end
- function test3()
- term.setCursor(1,25)
- term.write("Free Memory: "..computer.freeMemory().." bytes")
- end
- function test4()
- computer.shutdown(true)
- end
- term.setCursorBlink(false)
- gpu.setResolution(80, 25)
- clear()
- fillTable()
- heading("Button API Demo! Created in CC by DW20, ported to OC by MoparDan!")
- while true do
- getClick()
- end
- --eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement