Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onCommand(cmd)
- -- fix moviment
- if(cmd == 0) then
- turtle.forward()
- elseif(cmd == 1) then
- turtle.back()
- elseif(cmd == 2) then
- turtle.turnLeft()
- elseif(cmd == 3) then
- turtle.turnRight()
- end
- end
- rednet.open("right")
- local id = rednet.lookup("leo1553", "controller")
- if(id == nil) then
- print("Server not Found.")
- end
- rednet.send(id, "Connected.", "leo1553")
- while(true) do
- local event, recId, msg = os.pullEvent("rednet_message")
- if(recId == id) then
- print(msg)
- onCommand(tonumber(msg))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement