Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap( "left" )
- readout = "Awaiting time shift."
- side = "back" --redstone output side
- mon.write(readout)
- print(readout)
- time1 = 6.00
- time2 = 18.00
- event = "blank"
- input = "blank"
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function rnd() --reset and display
- mon.clear()
- mon.setCursorPos(1,1)
- sunrise = os.setAlarm(time1)
- sunset = os.setAlarm(time2)
- print(readout)
- mon.write(readout)
- end
- function dbug()
- print("event:" .. event)
- print("input:" .. input)
- print("readout:" .. readout)
- end
- rnd()
- while true do
- event, input = os.pullEvent("alarm")
- if input == sunrise then
- redstone.setOutput(side, false)
- readout = "Good Morning."
- rnd()
- -- dbug()
- print("lights out.")
- sleep(1)
- elseif input == sunset then
- redstone.setOutput(side, true)
- readout = "Good Night."
- rnd()
- -- dbug()
- print("lights on.")
- sleep(1)
- end
- end
- clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement