Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Ascensore (C) lego11
- altezza = 57
- function clear()
- term.clear()
- term.setCursorPos(1, 1)
- print("PLC ASCENSORE (C) lego11 2018")
- print("")
- end
- function sali()
- clear()
- print("Salita in corso")
- redstone.setOutput("right", true)
- sleep(0.2)
- redstone.setOutput("right", false)
- sleep(1)
- for i=1,altezza do
- redstone.setOutput("right", true)
- sleep(0.2)
- redstone.setOutput("right", false)
- sleep(0.6)
- end
- end
- function scendi()
- clear()
- print("Discesa in corso")
- redstone.setOutput("left", true)
- sleep(0.2)
- redstone.setOutput("left", false)
- sleep(1)
- for i=1,altezza do
- redstone.setOutput("left", true)
- sleep(0.2)
- redstone.setOutput("left", false)
- sleep(0.6)
- end
- end
- while true do
- clear()
- print("Attesa")
- os.pullEvent("redstone")
- if rs.getInput("bottom") == true then
- if rs.getInput("top") == true then
- sali()
- else
- scendi()
- end
- sleep(2)
- end
- end
Add Comment
Please, Sign In to add comment