Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Benutzer Einstellungen
- openTime = tonumber("6") -- Wann soll die Tür geöffnet werden
- closeTime = tonumber("19") -- Wann soll die Tür geschloßen werden
- modul = "right" -- Wo ist das Wireless Modul
- online = "left" -- Wo ist der Online Player Detector
- protokoll = "1600" -- Auf welchem Protokoll soll das Signal gesendet werden
- -- Programm Variablen
- besitzer = "Offline"
- tag = "Nein"
- -- Funktionen
- function dashboard()
- shell.run("clear")
- print("Eingangs Verwaltung")
- print("Besitzer: " .. besitzer)
- print("Tag: " .. tag)
- end
- function update()
- if (os.time() > openTime and os.time() < closeTime) then
- tag = "Ja"
- else
- tag = "Nein"
- end
- if rs.getInput(online) == true then
- besitzer = "Online"
- else
- besitzer = "Offline"
- end
- dashboard()
- if (besitzer == "Online" and tag == "Ja") then
- rednet.broadcast(protokoll .. "aufmachen")
- else
- rednet.broadcast(protokoll .. "zumachen")
- end
- end
- function redstone()
- local event = os.pullEvent("redstone")
- update()
- end
- function wecker()
- local event = os.pullEvent("alarm")
- update()
- end
- -- Einmalig nach dem Start
- -- Programm
- rednet.open(modul)
- update()
- ------------------------------------
- -- In der Scheilfe
- while true do
- os.setAlarm(openTime)
- os.setAlarm(closeTime)
- parallel.waitForAny(redstone, wecker)
- end
Add Comment
Please, Sign In to add comment