Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x =10
- left = false
- right = false
- route = 0
- sides = {"left", "right"}
- m = peripheral.wrap("top");
- function mprint(text)
- m.clear()
- m.setCursorPos(1, 1)
- m.write(text)
- end
- function rsdetect()
- if ( rs.getInput(sides[1]) ) then
- -- mprint("bal oldal aktív")
- inout(sides[1])
- elseif (rs.getInput(sides[2]) ) then
- -- mprint("jobb oldal aktív")
- inout(sides[2])
- end
- end
- function inout(side)
- if ( side == "left" and left == false and right == false) then
- left = true
- elseif ( left == true and side == "right" ) then
- mprint("enter")
- left = false
- right = false
- end
- if ( side == "right" and right == false and left == false) then
- right = true
- elseif ( right == true and side == "left" ) then
- mprint("exit")
- left = false
- right = false
- end
- end
- while ( true ) do
- rsdetect()
- x = x - 1
- if ( x == 1 ) then
- m.clear()
- end
- sleep(.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement