Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function aff1()
- local i = 10
- monl = peripheral.wrap("left")
- local x1, y1 = monl.getSize()
- local x, y
- for i=10, 1, -1 do
- monl.write(i)
- x, y = monl.getCursorPos()
- if y1 == y then
- monl.scroll(1)
- monl.setCursorPos(1, y)
- else
- monl.setCursorPos(1, y+1)
- end
- sleep(1)
- end
- monl.write("fonction aff1 finie !")
- x, y = monl.getCursorPos()
- if y1 == y then
- monl.scroll(1)
- monl.setCursorPos(1, y)
- else
- monl.setCursorPos(1, y+1)
- end
- end
- function aff2()
- local i = 0
- monr = peripheral.wrap("right")
- local x1, y1 = monr.getSize()
- local x, y
- for i=1, 7 do
- monr.write(i)
- x, y = monr.getCursorPos()
- if y1 == y then
- monr.scroll(1)
- monr.setCursorPos(1, y)
- else
- monr.setCursorPos(1, y+1)
- end
- sleep(1)
- end
- monr.write("fonction aff2 finie !")
- x, y = monr.getCursorPos()
- if y1 == y then
- monr.scroll(1)
- monr.setCursorPos(1, y)
- else
- monr.setCursorPos(1, y+1)
- end
- end
- --**************************--
- -- Main Program --
- --**************************--
- -- waitForAny : stop a la 1ere fonction
- -- qui se termine
- parallel.waitForAny(aff1, aff2)
- -- waitForAll : stop quand toutes les
- -- fonctions sont finies
- -- parallel.waitForAll(aff1, aff2)
- monr.write("Programme fini !")
- monl.write("Programme fini !")
Advertisement
Add Comment
Please, Sign In to add comment