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

calling a program on a peripheral

Started by coranos, 26 December 2012 - 06:01 AM
coranos #1
Posted 26 December 2012 - 07:01 AM
hi,
I tried searching for the answer, and didn't find it, how do you call a program on a peripheral?

For example, say I want to have a master turtle walk on top of a set of slave turtles and run a program on all slave turtles.

I want to do the equivalent of typing out these two commands:
"rom/programs/read-image/bmt 00"
"rom/programs/read-image/bmt 01"

local numTurtles = 2
for turtleNumber=1,numTurtles do
local montageNumber = string.format("%02d", turtleNumber-1)
turtle.forward();
peripheral.call("bottom", "turnOn")
peripheral.call("bottom", "os.run", "rom/programs/read-image/bmt", montageNumber)
end
Lyqyd #2
Posted 26 December 2012 - 07:11 AM
You can't. Try using rednet to send them the commands.
Mikeemoo #3
Posted 26 December 2012 - 07:55 AM
The only way I know of is to have your master turtle drop a disk drive next to a slave turtle, insert a disk, rename the program you want to use to startup, then boot the slave turtle.

It's not pretty, but if i recall correctly it does work.
coranos #4
Posted 26 December 2012 - 04:35 PM
So, how do I make all the slave turtles listen to rednet? call turnOn and run a custom startup program?
PixelToast #5
Posted 26 December 2012 - 05:13 PM
yea, thats how i did it