SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI("button")
| |
| 2 | m = peripheral.wrap("top")
| |
| 3 | m.clear() | |
| 4 | ||
| 5 | function fillTable() | |
| 6 | button.setTable("Test1", test1, 10,20,3,5)
| |
| 7 | button.setTable("Test2", test2, 22,32,3,5)
| |
| 8 | button.setTable("Test3", test3, 10,20,8,10)
| |
| 9 | button.setTable("Test4", test4, 22,32,8,10)
| |
| 10 | button.screen() | |
| 11 | end | |
| 12 | ||
| 13 | function getClick() | |
| 14 | event,side,x,y = os.pullEvent("monitor_touch")
| |
| 15 | button.checkxy(x,y) | |
| 16 | end | |
| 17 | ||
| 18 | function test1() | |
| 19 | button.flash("Test1")
| |
| 20 | print("Test1")
| |
| 21 | end | |
| 22 | ||
| 23 | function test2() | |
| 24 | button.toggleButton("Test2")
| |
| 25 | print("Test2")
| |
| 26 | end | |
| 27 | ||
| 28 | function test3() | |
| 29 | print("Test3")
| |
| 30 | end | |
| 31 | ||
| 32 | function test4() | |
| 33 | print("Test4")
| |
| 34 | end | |
| 35 | ||
| 36 | fillTable() | |
| 37 | button.heading("Demo Button Prog")
| |
| 38 | button.label(1,5,"Demo!") | |
| 39 | ||
| 40 | while true do | |
| 41 | getClick() | |
| 42 | end |