34 posts
Posted 21 October 2012 - 02:32 PM
ok so i have got a turtle and a computer that are both wireless and working (i can see the red band on the modem) on the turtle i type rednet.receive() and then the cursor disapears and waits for a signal like it should i think so i then move to my computer and type rednet.broadcast("go forward") i get back true but then i realise the turtle hasnt moved and on the turtle i get 2.236068?
thanks
lewanator1
231 posts
Posted 21 October 2012 - 02:35 PM
rednet.receive doesn't automatically run commands. You have to set up a program that makes it run commands when it receives messages. For example:
while true do
local sender, message = rednet.receive()
if message == "go forward" then
turtle.forward()
end
end
52 posts
Location
Scotland
Posted 21 October 2012 - 02:36 PM
The turtle receives the message from the computer as the string "go forward" but it doesn't execute this as a command.
209 posts
Location
In your fridge.
Posted 21 October 2012 - 02:37 PM
Try rednet.receive(5) so it listens for a longer period. And I assume you have a program to read strings for the turtle? If this doesn't work, show us your code.
34 posts
Posted 21 October 2012 - 02:37 PM
The turtle receives the message from the computer as the string "go forward" but it doesn't execute this as a command.
rednet.receive doesn't automatically run commands. You have to set up a program that makes it run commands when it receives messages. For example:
while true do
local sender, message = rednet.receive()
if message == "go forward" then
turtle.forward()
end
end
ah ok thanks guys messed that up abit :)/>/> this is going to take some messing to get it working :)/>/>
52 posts
Location
Scotland
Posted 21 October 2012 - 02:38 PM
You'll need to write a loop or if statement in order for this to execute something:
Example:
id, message = rednet.receive()
if message == "go forward" then
– code to move the turtle forwards
else
– code to make the turtle do something else like move backwards
end
np
34 posts
Posted 21 October 2012 - 02:45 PM
hmm i have some code i copied from somwhere that uses a gps tower the one that you type goto (cords here) how would i make a program for that so i can send the cords for my turtle to go to from my computer in my house?
thanks
34 posts
Posted 21 October 2012 - 02:50 PM
.
214 posts
Posted 21 October 2012 - 03:19 PM
im about to upload a turtle remote control system, il post a link here as soon as its done.
34 posts
Posted 21 October 2012 - 04:17 PM
im about to upload a turtle remote control system, il post a link here as soon as its done.
Aww sweet dude thanks very much!
214 posts
Posted 21 October 2012 - 05:03 PM
here ya go, heres the link:
http://www.computercraft.info/forums2/index.php?/topic/5270-turtle-control-v20/make no changes to the turtle code but on the client code find out where the to notes are, to find these look for "–" and the end of a line and read them. they will tell you what to change the values to.
thanks -Cheeky