Advertisement
Cedricator

Reaktor Cedricator

Jun 5th, 2020
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. --Initialisieren
  2. rednet.open("front")
  3. mon = peripheral.wrap("top")
  4. mon.clear()
  5. mon.setTextScale(1)
  6.  
  7.  
  8. --Boot
  9. function Boot()
  10. zeile1 = "+---------------------------+"
  11. zeile2 = "| |"
  12. zeile3 = "| Wilkommen Cedricator |"
  13. zeile4 = "| |"
  14. zeile5 = "+---------------------------+"
  15.  
  16. mon.setCursorPos(1,1)
  17. mon.write(zeile1)
  18. mon.setCursorPos(1,2)
  19. mon.write(zeile2)
  20. mon.setCursorPos(1,3)
  21. mon.write(zeile3)
  22. mon.setCursorPos(1,4)
  23. mon.write(zeile4)
  24. mon.setCursorPos(1,5)
  25. mon.write(zeile5)
  26.  
  27. sleep(3)
  28. end
  29. Boot()
  30. rs.setOutput("right", true)
  31. sleep(1)
  32. rs.setOutput("back", true)
  33. sleep(1)
  34. rs.setOutput("left", true)
  35. sleep(1)
  36.  
  37. function button_ON()
  38.  
  39. mon.setBackgroundColor(colors.lime)
  40. mon.setCursorPos(3,3)
  41. mon.write(" Power I ")
  42. mon.setBackgroundColor(colors.black)
  43.  
  44. end
  45.  
  46. function button_OFF()
  47.  
  48. mon.setBackgroundColor(colors.red)
  49. mon.setCursorPos(19,3)
  50. mon.write(" Power 0 ")
  51. mon.setBackgroundColor(colors.black)
  52.  
  53. end
  54.  
  55. function Overlay()
  56. mon.clear()
  57.  
  58. zeile1 = "+---------------------------+"
  59. zeile2 = "| |"
  60. zeile3 = "| |"
  61. zeile4 = "| |"
  62. zeile5 = "+---------------------------+"
  63.  
  64. mon.setCursorPos(1,1)
  65. mon.write(zeile1)
  66. mon.setCursorPos(1,2)
  67. mon.write(zeile2)
  68. mon.setCursorPos(1,3)
  69. mon.write(zeile3)
  70. mon.setCursorPos(1,4)
  71. mon.write(zeile4)
  72. mon.setCursorPos(1,5)
  73. mon.write(zeile5)
  74.  
  75. button_ON()
  76. button_OFF()
  77.  
  78. end
  79.  
  80. --Overlay
  81. Overlay()
  82.  
  83. while true do
  84.  
  85. event, side, x, y = os.pullEvent("monitor_touch")
  86. if x > 2 and x < 12 and y == 3 then
  87. rednet.send(401, "Trigger")
  88. rednet.send(401, "ON")
  89. end
  90.  
  91. event, side, x, y = os.pullEvent("monitor_touch")
  92. if x > 19 and x < 27 and y == 3 then
  93. rednet.send(401, "Trigger")
  94. rednet.send(401, "OFF")
  95. end
  96. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement