Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- rc_send1
- -- タートルをラジコンにするプログラム(リモコン側)
- -- Config
- local id = 65535 -- 送信先ID
- -- Functions
- function init()
- term.clear()
- term.setCursorPos(1,1)
- print(" w ")
- print("a d")
- print(" s ")
- end
- -- Condition Table
- local cond = {}
- cond["w"] = "go_forward"
- cond["a"] = "strafe_left"
- cond["d"] = "strafe_right"
- cond["s"] = "go_back"
- -- Main
- rednet.open("back") -- ポケットコンピュータは後ろ側にモデムがある
- while true do
- init()
- local event, moji = os.pullEvent("char")
- print(moji)
- if cond[moji] then -- もし送信メッセージを取り出すことができたら、
- rednet.send(id, cond[moji])
- else -- そうでなければ、
- print("wrong moji")
- end
- os.sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement