Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local arg= {...}
- arg1=arg[1]
- if arg1==nil then
- data="0000000000000000"
- elseif #arg1>16 then
- print("votre donee doit pas contenir plus de 16 bits")
- elseif #arg1<16 then
- for i=1,16-#arg1 do
- arg1="0"..arg1
- end
- else
- for i=1,#arg1 do
- ascii=string.byte(arg1,i)
- if ascii<48 or ascii>49 then
- print("la donnee doit etre un nombre binaire")
- do return end
- end
- end
- data=string.reverse(arg1)
- end
- arg2=arg[2]
- if arg2==nil then
- tick=4
- else
- for i=1,#arg2 do
- ascii=string.byte(arg2,i)
- if ascii<48 or ascii>57 then
- print("cette donnee doit etre un nombre")
- do return end
- end
- tick=(ascii-48)*10^(i-1)
- end
- end
- arg3=arg[3]
- arg4=arg[4]
- if arg3==nil or arg4==nil then
- sideclk="right"
- sidedat="back"
- elseif (arg4~="right" and arg4~="left" and arg4~="top" and arg4~="bottom" and arg4~="front" and arg4~="back") or (arg3~="right" and arg3~="left" and arg3~="top" and arg3~="bottom" and arg3~="front" and arg3~="back") then
- print("cote invalide les cote valides sont: front,back,top,bottom,right,left")
- do return end
- elseif arg4==arg3 then
- print("vous ne pouvez pas envoyer la donnee et l'horloge sur le meme cable redstone")
- do return end
- elseif peripheral.getType(arg4)~="factoryredstonecable" or peripheral.getType(arg3)~="factoryredstonecable" then
- print("votre cable doit etre un rednet cable venant du mod Mine Factory Reloaded ces cable doivent etre connecte a un programable rednet controler qui effectuera la desserialisation")
- do return end
- else
- sideclk=arg3
- sidedat=arg4
- end
- for i=1,#data do
- bit=string.sub(data,i,i)
- redstone.setOutput(sideclk,true)
- os.sleep(tick*0.05)
- redstone.setOutput(sideclk,false)
- if bit=="1" then
- redstone.setOutput(sidedat,true)
- os.sleep(tick*0.05)
- else
- redstone.setOutput(sidedat,false)
- os.sleep(tick*0.05)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment