Advertisement
lego11

Quadro elettroco

Jun 23rd, 2018
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. --Configurazione
  2. --Lato uscita luci
  3. lato_luci = "back"
  4.  
  5. --lato Monitor
  6. lato_monitor = "left"
  7.  
  8.  
  9. function colore(sfumatura)
  10. m.setTextColour(sfumatura)
  11. end
  12.  
  13. function fineColore()
  14. m.setTextColour(colours.white)
  15. end
  16. function commutaLuci()
  17. if luci ~= true then
  18. luci = true
  19. rs.setOutput(lato_luci, true)
  20. m.setCursorPos(12, 4)
  21. colore(colours.lime)
  22. m.write("[ON]")
  23. fineColore()
  24. else
  25. luci = false
  26. rs.setOutput(lato_luci, false)
  27. m.setCursorPos(12, 4)
  28. colore(colours.red)
  29. m.write("[OFF]")
  30. fineColore()
  31. end
  32. end
  33.  
  34.  
  35. print("Display attivato")
  36. luci = false
  37.  
  38. m = peripheral.wrap(lato_monitor)
  39. m.setCursorPos(1, 1)
  40. m.write(" ________________")
  41. m.setCursorPos(1, 2)
  42. m.write("| Quadro Comando |")
  43. m.setCursorPos(1, 3)
  44. m.write("| |")
  45. m.setCursorPos(1, 4)
  46. m.write("| Luci: [ ] |")
  47. m.setCursorPos(1, 5)
  48. m.write("|________________|")
  49.  
  50. while true do
  51. event, button, x, y = os.pullEvent()
  52. if event == "mouse_click" and y == 4 then
  53. commutaLuci()
  54. end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement