Advertisement
Skillkiller

Lichtkontroll Einheit

Jul 25th, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. --Befehle
  2. -- Normal Light on [Zone]
  3. -- Normal Light off [Zone]
  4.  
  5. --Variablen
  6. wModul = "left" --Angabe fΓΌr die Position des Wirless Modems
  7. Zone = "Schalfzimmer"
  8. NormalLight = true
  9. RedLight = false
  10.  
  11. --Code
  12. function Command()
  13. senderId, message, protocol = rednet.receive("1900Light")
  14. if (message == "Normal Light on " .. Zone or message == "Normal Light on ALL") then
  15. NormalLight = true
  16. redstone.setOutput("front", NormalLight)
  17. rednet.send(senderId, NormalLight, "1900Light")
  18.  
  19. elseif (message == "Normal Light off " .. Zone or message == "Normal Light off ALL") then
  20. NormalLight = false
  21. redstone.setOutput("front", NormalLight)
  22. rednet.send(senderId, NormalLight, "1900Light")
  23.  
  24. elseif (message == "Red Light on " .. Zone or message == "Red Light on ALL") then
  25. RedLight = true
  26. redstone.setOutput("back",RedLight)
  27. rednet.send(senderId, RedLight, "1900Light")
  28.  
  29. elseif (message == "Red Light off " .. Zone or message == "Red Light off ALL") then
  30. RedLight = false
  31. redstone.setOutput("back", RedLight)
  32. rednet.send(senderId, RedLight, "1900Light")
  33. end
  34. Dashboard()
  35. end
  36.  
  37. function Dashboard()
  38. shell.run("clear")
  39. print("Lichtkontroll Einheit")
  40. print("FΓΌr die Zone: " .. Zone)
  41. print()
  42. print("Normales Licht: " .. tostring(NormalLight))
  43. print("Rotes Licht:    " .. tostring(RedLight))
  44. end
  45.  
  46. --Einmal Code
  47. rednet.open(wModul)
  48. Dashboard()
  49.  
  50. if NormalLight == true then
  51. redstone.setOutput("front", true)
  52. else
  53. redstone.setOutput("front", false)
  54. end
  55. if RedLight == true then
  56. redstone.setOutput("back",true)
  57. else
  58. redstone.setOutput("back", false)
  59. end
  60.  
  61. while true do
  62. Command()
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement