Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- camera = peripheral.wrap("camera_0")
- mon = peripheral.wrap("right")
- mon.setTextScale(5)
- while true do
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write(camera.distance())
- os.sleep(1)
- side = "back"
- function door(num)
- redstone.setBundledOutput(side, num)
- redstone.setBundledOutput("left", colors.yellow)
- sleep(.2)
- redstone.setBundledOutput(side, 0)
- sleep(1.5)
- end
- function open()
- repeat door(colors.orange)
- until camera.distance() == 5
- redstone.setBundledOutput("left", 0)
- end
- function close()
- repeat door(colors.white)
- until camera.distance() == 0
- redstone.setBundledOutput("left", 0)
- end
- if redstone.getInput("front") == true then
- if camera.distance() == 5 then
- close()
- else open()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement