Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- open_receive1
- -- 遠隔操作で扉を開けるプログラム(メッセージ受信側)
- local open_msg = "Open" -- 開くメッセージ
- local close_msg = "Close" -- 閉めるメッセージ
- rednet.open("right") -- 右側に設置したモデムを使うという宣言
- while true do
- local id, msg = rednet.receive() -- メッセージを待ち受ける
- print(id, msg)
- if msg == open_msg then -- もし受信メッセージが"Open"ならば、
- redstone.setOutput("top", true)
- elseif msg == close_msg then -- もし受信メッセージが"Close"ならば、
- redstone.setOutput("top", false)
- else -- どれでもなければ、
- print("wrong")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement