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
- closeTime = tonumber("19") -- Wann soll die Tür geschloßen werden
- red = "right" -- Auf welcher Seite soll das Redstone Signal ausgegeben werden
- red2 = "left"
- -- Programm
- function update()
- if (os.time() > openTime and os.time() < closeTime) then
- tag = "Ja"
- else
- tag = "Nein"
- end
- if tag == "Ja" then
- redstone.setOutput(red, true)
- redstone.setOutput(red2, true)
- else
- redstone.setOutput(red, false)
- redstone.setOutput(red2, true)
- end
- dashboard()
- end
- function dashboard()
- shell.run("clear")
- print("Tag / Nacht Deflector Steuerung")
- if tag == "Ja" then
- print("Status: Tag")
- else
- print("Status: Nacht")
- end
- print("\195\150ffnungszeit: " .. tostring(openTime) .. " Uhr")
- print("Schlie\195\159zeit: " .. tostring(closeTime) .. " Uhr")
- end
- function wecker()
- local event = os.pullEvent("alarm")
- update()
- end
- -- Einmalig nach Start
- update()
- while true do
- os.setAlarm(openTime)
- os.setAlarm(closeTime)
- wecker()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement