Advertisement
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
- warnTime = tonumber("5") -- Wann soll gewanrt werden
- closeTime = tonumber("19") -- Wann soll die Tür geschloßen werden
- modul = "top" -- Wo ist das Wireless Modul
- function update()
- if (os.time() > warnTime and os.time() < closeTime) then
- warnung(true)
- else
- warnung(false)
- end
- if (os.time() > openTime and os.time() < closeTime) then
- tag = true
- else
- tag = false
- end
- rednet.broadcast("status?", "1900Player")
- senderId, message, protocol = rednet.receive("1900Player", 10)
- if message == "Online" then
- POnline = true
- else
- POnline = false
- end
- if (tag == true and POnline == true) then
- --Tür wird geöffnet
- redstone.setOutput("left", true)
- sleep(10)
- redstone.setOutput("left", false)
- else
- --Tür wird geschlossen
- --Comming soon
- end
- end
- function warnung(an)
- if an == true then
- rednet.broadcast("warn On", "1900Door")
- else
- rednet.broadcast("warn Off", "1900Door")
- end
- end
- function wecker()
- local event = os.pullEvent("alarm")
- update()
- end
- rednet.open(modul)
- update()
- while true do
- os.setAlarm(openTime)
- os.setAlarm(warnTime)
- os.setAlarm(closeTime)
- parallel.waitForAny(wecker)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement