Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local sides = require("sides")
- local term = require("term")
- local outputSide = sides.top
- local rsAddress = nil
- for address, ctype in component.list("redstone") do
- rsAddress = address
- break
- end
- if rsAddress == nil then
- print("No redstone IO")
- exit()
- end
- local rs = component.proxy(rsAddress)
- function zapnout()
- term.clear()
- rs.setOutput(outputSide, 15)
- print("Redstone zapnut.")
- os.sleep(0.5)
- menu()
- end
- function vypnout()
- term.clear()
- rs.setOutput(outputSide, 0)
- print("Redstone vypnut.")
- os.sleep(0.5)
- menu()
- end
- function menu()
- term.clear()
- print("Redstone ovládání")
- print("1 - Zapnout")
- print("2 - Vypnout")
- local input = io.read()
- if input == "1" then
- zapnout()
- elseif input == "2" then
- vypnout()
- else
- print("Neplatná volba.")
- end
- end
- menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement