0

コンピューター 0 は、他の端末から情報を受信し、情報を解釈して、モニターに送信するための中央コンピューターです。外部端末に異なるレートで情報を送信させます。1 秒に数回更新されるものもあれば、1 分に 1 回更新されるものもあります。基本的な考え方は単純です。コンピューター 0

local mon = peripheral.wrap("top")
rednet.open("right")

local id = nil
local msg = {}
while true do
    mon.clear()
    id, smsg = rednet.receive()
    if smsg ~= nil then
        msg[id]= smsg
    end
    for i = 1,#msg do
        mon.setCursorPos(1,i)
        mon.write(msg[i])
    sleep(0.1)
end

その他のコンピュータ

rednet.open("top")
local n=1
while true do
    rednet.broadcast(0,n)
    n = n+1
    sleep(0.5) --Sleep timer is arbitrary. I just want the central computer to update each individual computers info as they come in.
end

はい、これが大混乱を引き起こすことは理解していますが、基本的なアイデアを機能させたいだけです。その後、後で必要に応じて ID とプロトコルを確認できます。私はいくつかの並列処理を行う必要があることを十分に知っていますが、それだけです。私はまだこのことに慣れていないので、初心者のすぐ上にいます。

4

0 に答える 0