Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Configurazione
- --Lato uscita luci
- lato_luci = "back"
- --lato Monitor
- lato_monitor = "left"
- function colore(sfumatura)
- m.setTextColour(sfumatura)
- end
- function fineColore()
- m.setTextColour(colours.white)
- end
- function commutaLuci()
- if luci ~= true then
- luci = true
- rs.setOutput(lato_luci, true)
- m.setCursorPos(12, 4)
- colore(colours.lime)
- m.write("[ON]")
- fineColore()
- else
- luci = false
- rs.setOutput(lato_luci, false)
- m.setCursorPos(12, 4)
- colore(colours.red)
- m.write("[OFF]")
- fineColore()
- end
- end
- print("Display attivato")
- luci = false
- m = peripheral.wrap(lato_monitor)
- m.setCursorPos(1, 1)
- m.write(" ________________")
- m.setCursorPos(1, 2)
- m.write("| Quadro Comando |")
- m.setCursorPos(1, 3)
- m.write("| |")
- m.setCursorPos(1, 4)
- m.write("| Luci: [ ] |")
- m.setCursorPos(1, 5)
- m.write("|________________|")
- while true do
- event, button, x, y = os.pullEvent()
- if event == "mouse_click" and y == 4 then
- commutaLuci()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement