Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- MC Eternal mod pack
- -- operates the garage door - open at sunrise, close at sunset
- -- pastebin -f get R9uZxYxJ rtest
- local robot=require("robot")
- local computer=require("computer")
- local component=require("component")
- local sides = require("sides")
- -- functions
- -- main
- local doorstate = "closed"
- local daycheck = 1.0
- while true do
- -- is it sunrise?
- if doorstate == "closed" then
- daycheck = component.redstone.getInput(sides.back)
- daycheck = math.floor(daycheck)
- print(daycheck)
- if daycheck >= 2 then
- -- sunrise open the door
- robot.use()
- robot.use()
- -- set a flag to note that the door is open
- doorstate = "open"
- end
- end
- -- is it sunset?
- if doorstate == "open" then
- daycheck = component.redstone.getInput(sides.back)
- daycheck = math.floor(daycheck)
- print(daycheck)
- if daycheck <= 0 then
- -- sunset close the door
- robot.use()
- robot.use()
- -- set a flag to note that the door is closed
- doorstate = "closed"
- end
- end
- -- wait
- os.sleep(20)
- end
- -- eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement