Posted 28 January 2016 - 02:18 AM
I am currently trying to write a program that checks if it is day or night, toggles a redstone output, then reboots and runs the program again (program is saved in startup) as to continuously check the time. It doesn't seem to be working, not sure why. Here's the code:
Any suggestions on how to fix this?
local time = os.time()
local function day()
redstone.setOutput("left", false)
sleep(1)
os.reboot()
end
local function night()
redstone.setOutput("left", true)
sleep(1)
os.reboot()
end
if time < 6 and time > 18 then
night()
else
day()
end
Any suggestions on how to fix this?