SHOW:
|
|
- or go back to the newest paste.
| 1 | API = require("buttonAPI")
| |
| 2 | local event = require("event")
| |
| 3 | local computer = require("computer")
| |
| 4 | local term = require("term")
| |
| 5 | local component = require("component")
| |
| 6 | local gpu = component.gpu | |
| 7 | ||
| 8 | local rs = component.redstone | |
| 9 | local colors = require("colors")
| |
| 10 | - | local side = require("sides")
|
| 10 | + | local sides = require("sides")
|
| 11 | ||
| 12 | function API.fillTable() | |
| 13 | - | API.setTable("Tick", test1, 10,20,3,5)
|
| 13 | + | API.setTable("Purgar", test1, 10,20,3,5)
|
| 14 | API.setTable("Activar", test2, 22,32,3,5)
| |
| 15 | API.setTable("Memoria", test3, 10,20,8,10)
| |
| 16 | API.setTable("Reiniciar", test4, 22,32,8,10)
| |
| 17 | API.setTable("Salir", test5, 10,32,13,15)
| |
| 18 | API.setTable("Autopurga", test6, 34,50,3,15)
| |
| 19 | API.setTable("Luces", test7, 52,62,3,5)
| |
| 20 | API.screen() | |
| 21 | end | |
| 22 | ||
| 23 | function getClick() | |
| 24 | local _, _, x, y = event.pull(1,touch) | |
| 25 | if x == nil or y == nil then | |
| 26 | local h, w = gpu.getResolution() | |
| 27 | gpu.set(h, w, ".") | |
| 28 | gpu.set(h, w, " ") | |
| 29 | else | |
| 30 | API.checkxy(x,y) | |
| 31 | end | |
| 32 | - | API.flash("Tick",0.01)
|
| 32 | + | |
| 33 | ||
| 34 | function test1() | |
| 35 | term.setCursor(1,25) | |
| 36 | term.write("Trabajando... ")
| |
| 37 | rs.setOutput(sides.right,15) | |
| 38 | - | -- # If the button is on (green) do something. |
| 38 | + | os.sleep(2) |
| 39 | API.flash("Purgar",0.25)
| |
| 40 | - | -- # If the button is off (red) do this instead. |
| 40 | + | rs.setOutput(sides.right,0) |
| 41 | term.setCursor(1,25) | |
| 42 | term.write("Estacion 3 purgada ")
| |
| 43 | os.sleep(1) | |
| 44 | term.setCursor(1,25) | |
| 45 | term.write("Sistema listo ")
| |
| 46 | end | |
| 47 | ||
| 48 | function test2() | |
| 49 | API.toggleButton("Activar")
| |
| 50 | if buttonStatus == true then | |
| 51 | term.setCursor(1,25) | |
| 52 | term.write("Trabajando... ")
| |
| 53 | rs.setOutput(sides.left,15) | |
| 54 | os.sleep(3) | |
| 55 | term.setCursor(1,25) | |
| 56 | term.write("Sistema listo ")
| |
| 57 | else | |
| 58 | - | API.label(1,24,"maumagro") |
| 58 | + | term.setCursor(1,25) |
| 59 | term.write("Trabajando... ")
| |
| 60 | rs.setOutput(sides.left,0) | |
| 61 | os.sleep(3) | |
| 62 | term.setCursor(1,25) | |
| 63 | term.write("Sistema listo ")
| |
| 64 | end | |
| 65 | end | |
| 66 | ||
| 67 | function test3() | |
| 68 | term.setCursor(1,25) | |
| 69 | term.write("Memoria libre: "..computer.freeMemory().." bytes")
| |
| 70 | os.sleep(3) | |
| 71 | term.setCursor(1,25) | |
| 72 | term.write("Sistema listo ")
| |
| 73 | end | |
| 74 | ||
| 75 | function test4() | |
| 76 | computer.shutdown(true) | |
| 77 | end | |
| 78 | ||
| 79 | function test5() | |
| 80 | term.clear() | |
| 81 | os.exit() | |
| 82 | end | |
| 83 | ||
| 84 | function test6() | |
| 85 | term.setCursor(1,25) | |
| 86 | term.write("Trabajando... ")
| |
| 87 | API.flash("Autopurga",0.25)
| |
| 88 | rs.setOutput(sides.front,15) | |
| 89 | os.sleep(2) | |
| 90 | rs.setOutput(sides.front,0) | |
| 91 | term.setCursor(1,25) | |
| 92 | term.write("Estacion purgada")
| |
| 93 | os.sleep(1) | |
| 94 | term.setCursor(1,25) | |
| 95 | term.write("Sistema listo ")
| |
| 96 | end | |
| 97 | ||
| 98 | function test7() | |
| 99 | API.toggleButton("Luces")
| |
| 100 | if buttonStatus == true then | |
| 101 | term.setCursor(1,25) | |
| 102 | term.write("Trabajando... ")
| |
| 103 | os.sleep(3) | |
| 104 | rs.setOutput(sides.back,15) | |
| 105 | term.setCursor(1,25) | |
| 106 | term.write("Sistema listo ")
| |
| 107 | else | |
| 108 | term.setCursor(1,25) | |
| 109 | term.write("Trabajando... ")
| |
| 110 | os.sleep(3) | |
| 111 | rs.setOutput(sides.back,0) | |
| 112 | term.setCursor(1,25) | |
| 113 | term.write("Sistema listo ")
| |
| 114 | end | |
| 115 | end | |
| 116 | ||
| 117 | term.setCursorBlink(false) | |
| 118 | gpu.setResolution(80, 25) | |
| 119 | API.clear() | |
| 120 | API.fillTable() | |
| 121 | API.heading("Kerberos. Tablero de control de sistemas")
| |
| 122 | API.label(1,24,"Drizzard 2016. maumagro") | |
| 123 | ||
| 124 | while true do | |
| 125 | getClick() | |
| 126 | end | |
| 127 | ||
| 128 | ||
| 129 | ||
| 130 | --eof |