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

Wireless turtles

Started by Mrblue247, 04 January 2016 - 10:59 AM
Mrblue247 #1
Posted 04 January 2016 - 11:59 AM
I want to control mining turtles using a wireless pocket computer. I want to be able to open the pocket computer and say "tunnel 50" and all of the turtles will start digging, instead of having to manually do it. Any help will be appreciated :)/>
Obsidia #2
Posted 04 January 2016 - 03:25 PM
At first you want to have a program running on your pocket computer:

Should be something like this:

rednet.open("back", 50)								-- 50 is the channel and can be replaced by any number.
while true do
term.clear()
term.setCursorPos(1,1)
write(Command: ")
input = read()
rednet.broadcast(input)
end

This is the basic code I use most of the time.


Turtle:

rednet.open("left", 50)  -- Left is the side of the modem and 50 is the channel were using
while true do
id, msg = rednet.receive()
print(msg)								  -- This will print the message you have send from the pocket computer onto the turtle screen
if msg == "Tunnel" then						   -- If you send the message "Tunnel" the turtle will do this(You want to write your Tunnel code into here)
for i=20 do
   turtle.dig()
   turtle.digUp()
   turtle.forward()
elseif msg == "torch" then
   turtle.select(1)
   turtle.place()
end
end

I havent tried it out but it should work like this.
I hope I could help you somehow.
Just ask if you need some more help
Edited on 04 January 2016 - 02:27 PM