2 posts
Posted 01 April 2012 - 10:05 AM
Hey Guys, (Sorry for my Bad English!) I've trying to put the Coordinates from my GPS System into X, Y and Z Variables.
But I have no ideas how to do this.
Thanks for Help :)/>/>
286 posts
Location
Bonn Germany
Posted 01 April 2012 - 10:19 AM
You have to use the GPS API
x, y, z = gps.locate(timeout, debug)
Guess that's the way to do it.
If not take a look at the wiki
http://computercraft.info/wiki/index.php?title=Gps_(API)
2 posts
Posted 02 April 2012 - 05:10 PM
Ok.
And how can I programm that the Turtle go to a special Coordinate???
1111 posts
Location
Portland OR
Posted 02 April 2012 - 10:16 PM
That's a little more complicated. You will need to figure out a way for the turtle to know and keep track of which direction it is facing. Using a var and assigning it a value between 0 - 3 for north - south and adding or subtracting as you turn should work for that. Then subtract where you want to go from where you are at to get the number of steps that you need to take in order to reach the specified location. From there its just figuring out which directions you need to go and then go. Some of the numbers will probably be negatives, use that to figure out if its north vs south(for example if x == -10 could be 10 steps north, while x == 10 would be 10 steps south). You will have to convert the number to positive if you are going to use it for the turtle to know how far to go.
It would probably be best to either make a series of functions for this, or even better an API. I know there is one API already posted that does this, and I have one of my own that is not posted that I could share if you need.
Definitely a fun project.