This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Fireworrks's profile picture

Control mining turtles from one computer

Started by Fireworrks, 14 February 2013 - 12:27 AM
Fireworrks #1
Posted 14 February 2013 - 01:27 AM
Topic: Control mining turtles from one computer

How would I go about controlling turtles around my world (starting/ending programs) with a computer at my home base. I have Wireless modems attached to both devices.
Doyle3694 #2
Posted 14 February 2013 - 02:41 AM
Turtle code:

rednet.open("right")
computerID = 0 -- Change 0 to your computer ID
while true do
 id,message,distance = rednet.receive()
 if id == computerID then
  shell.run(message)
 end
end
Then you can simply send what program to run with which arguments to the turtle.
Lyqyd #3
Posted 14 February 2013 - 07:11 AM
You could also try using something like nsh if you want a more interactive sort of control. With nsh, you can upload and download files, and even edit files on the turtle from the computer!

If you are looking for information about how to code this yourself, the general starting point is to have a program on the turtle that listens for incoming commands and executes them. Something really basic like:


rednet.open("right")
while true do
  id, message = rednet.receive()
  shell.run(message)
end

Or like what Doyle posted, which includes ID filtering.