Jump to content




Communicating computer to computer

turtle

5 replies to this topic

#1 peon2

  • Members
  • 3 posts

Posted 18 December 2015 - 10:37 PM

So I've been trying to make a turtle mass block miner. Rather than have one slow turtle I want a wall :D. Is there any way to write from turtle to turtle quickly using the peripheral API? I've looked around the wiki but I couldn't find anything. Any reply would be helpful!

per=peripheral.getNames()
for k,v in pairs(per) do
  if (peripheral.getType(v)=="turtle") then
	 m = peripheral.wrap(v)

	 -- copy this code to other turtles and make them run it
  
	 while true do
	   turtle.dig()
	   turtle.drop()
	   turtle.forward()
	 end
  end
end

Something along those lines would be great.

#2 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 18 December 2015 - 11:25 PM

You can use rednet.

#3 CometWolf

  • Members
  • 1,283 posts

Posted 19 December 2015 - 12:48 AM

Rednet is geared more towards general communication, but yes it could work provided the turtle is already setup to execute whatever code it receives. A far better solution, which i have taken advantage of myself on occasion, is using one turtle to deploy other turtles then program them via a disk and a diskdrive. When a turtle/computer boots, it will run any file named "startup" on a connected diskdrive disk. You can use this file to setup whatever files you actually need on the turtle, then have the main turtle pick it back up and deploy another turtle using the same method.

Edit: On a second read i seem to have misunderstood the question partially haha, my bad. Though what i suggested is still ideal if you're gonna set up a large amount of turtles, which can then be controlled via rednet from somewhere else.

Edited by CometWolf, 19 December 2015 - 12:50 AM.


#4 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 19 December 2015 - 01:19 AM

View PostCometWolf, on 19 December 2015 - 12:48 AM, said:

Rednet is geared more towards general communication, but yes it could work provided the turtle is already setup to execute whatever code it receives. A far better solution, which i have taken advantage of myself on occasion, is using one turtle to deploy other turtles then program them via a disk and a diskdrive. When a turtle/computer boots, it will run any file named "startup" on a connected diskdrive disk. You can use this file to setup whatever files you actually need on the turtle, then have the main turtle pick it back up and deploy another turtle using the same method.

Edit: On a second read i seem to have misunderstood the question partially haha, my bad. Though what i suggested is still ideal if you're gonna set up a large amount of turtles, which can then be controlled via rednet from somewhere else.

Actually this idea is probably good, if he can get a single turtle to deploy other turtles, that all run the startup program, and copy it to themselves. And then wait for a rednet signal to run, it might work well.

#5 peon2

  • Members
  • 3 posts

Posted 19 December 2015 - 09:33 AM

From my experience using rednet requires the turtles to have code in place to listen, interpret the message, etc.

I was hoping to use newly crafted turtles. I will be trying the disk drive technique though!

#6 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 19 December 2015 - 10:16 AM

In terms of transmitting code to a newly crafted turtle, the disk drive method is your best - and indeed, only - option. Have the "parent" turtle.place() the "child" turtle, and then the disk drive next to that. turtle.drop() the disk with the desired code on it (in a "startup" file) into the drive, and then move back to the child and call its wrappedPeripheral.turnOn() function.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users