Ok, run the receive program on the turtle. Does it sit without a bliking cursor?
Now run the computer send program. It should go straight to the next line if successful.
Now go back to the turtle, it should now have a blinkinig cursor on the next line.
Now click the turtle and edit the writeTo file (writeTo is a variable) If you did not change the writeTo variable to something else, the data will be saved in a file called yourProgramName.
If the file is still empty then I want you to edit the readFrom file on your main computer, if there is nothing in it, then that is the reason. Also, if you did not change the readFrom file variable to your file name, then it is reading a non-existant file.
In order for this to work you MUST change these two variables:
local readFrom = "yourFileName" – where yourFileName is the file you are reading from on the main computer
local writeTo = "yourFileName" – where yourFileName is the file that is being written to on the turtle
So let's try an example where i'm reading from the file 'test' on the main computer and I will receive it's contents in a file named 'test' on the turtle:
--[[Main Computer]]--
local readFrom = "test"
rednet.open("right")
local program = {}
local file = fs.open(readFrom,"r")
local lines = file.readLine()
for lines in file.readLine do
table.insert(program,lines)
end
file.close()
local data = textutils.serialize(program)
rednet.broadcast(data)
--[[Turtle program]]--
local writeTo = "test"
rednet.open("right")
local _, id, message = os.pullEvent("rednet_message")
local data = textutils.unserialize(message)
local file = fs.open(writeTo,"w")
for i = 1,#data do
file.writeLine(data[i])
end
file.close()