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

Computer to Turtle

Started by crackroach, 01 October 2012 - 10:14 PM
crackroach #1
Posted 02 October 2012 - 12:14 AM
I've been working on a project to make turtle build custom building like walls, houses and tower. Since I use the terminal (computer) interface completely (the whole 50 by 18) with a graphic to show coordinate and stuff, I'd like to know if it is possible to start the program and transfer the variables to the turtle without using rednet???? Just like if it was a peripheral of some kind.

example:
print("how many time would you like the turtle to move forward?")
inputX = read()
inputX = tonumber(inputX)

function start()
peripheral.call("left", "turn on")
end

and then the turtle would do the inputX number…

thanks in advance
absorr #2
Posted 02 October 2012 - 02:39 AM
You could learn Java and create your own peripheral that does exactly this, you could look through the peripheral library to see if this exists, or use rednet. Choose an option and I will help you the rest of the way if you want.
crackroach #3
Posted 02 October 2012 - 02:39 PM
You could learn Java and create your own peripheral that does exactly this, you could look through the peripheral library to see if this exists, or use rednet. Choose an option and I will help you the rest of the way if you want.

I like the option of creating my own peripheral, but since my programming skills aren't that complete, it will be a great challenge… let's go for the java stuff. I already have notepad++ to program so if you any idea where i should start tell me i'm willing to learn. :D/>/>

I thought about it and i guess it would be easier to learn how to use rednet. However I'm still willing to learn java and do my own peripheral (that could help others like me). I've watch few tutorials on how to "play" with the rednet API, but it was a bit confusing… if you have any good tutorials to share or even if your personaly interested in helping me, I'll be glad. :(/>/>


Thanks
Mailmanq! #4
Posted 19 October 2012 - 02:42 AM
Rednet is really easy, you can just make a turtle react to strings sent to it, just do like the following on the console


while true do
  term.clear
  term.setCursorPos(1,1)
  term.write("What command would you like to send?")
  cmd = io.read()
  rednet.send(id, cmd) --Replace id with the ID of the turtle
  id, msg = rednet.receive()
  sleep(.1)
  print(msg)
end

--on the turtle


while true do
  sleep(.1)
  id,msg = rednet.receive()
  shell.run(msg)
  rednet.send(id, "SUCESS!")
end

that is really all there is to it