Posted 24 April 2013 - 01:13 PM
Hey! RiokuTheSlayer here,and i have a bit of a problem…..
I'm making a program that can control a turtle from a computer.
But the turtle won't move forward or backwards.I can,however,make it rotate.
Here's the code.
Computer:
Turtle:
Any help would be greatly appreciated!
Thank you for your time,
RiokuTheSlayer
I'm making a program that can control a turtle from a computer.
But the turtle won't move forward or backwards.I can,however,make it rotate.
Here's the code.
Computer:
rednet.open("back")
sleep (1)
print "This is the programs to control the turtle"
sleep (1)
print "Controls: W=Forward S=Backward A=Rotate Left D=Rotate Right."
while true do
local event, param1 = os.pullEvent ("char")
if param1 == "w" then
rednet.send(1,"W")
elseif param1 == "s" then
rednet.send(1,"S")
elseif param1 == "a" then
rednet.send(1,"A")
elseif param1 == "d" then
rednet.send(1,"D")
end
end
(may have a few space errors from copy/paste)Turtle:
rednet.open("right")
print("This is the turtle to be controlled.")
sleep(1)
while true do
local senderId, message, distance = rednet.receive()
if message == "W" then
turtle.forward()
elseif message == "S" then
turtle.back()
elseif message == "A" then
turtle.turnLeft()
elseif message == "D" then
turtle.turnRight()
end
end
Any help would be greatly appreciated!
Thank you for your time,
RiokuTheSlayer