Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function detSens()
- local sens = "0"
- x0,y0,z0 = gps.locate()
- step(1)
- x1,y2,z2 = gps.locate()
- turtle.left(2)
- step(1)
- turtle.right(2)
- local Xc = x0 - x1
- local Yc = y0 - y1
- If not (Xc == 0) then
- If (Xc < 0) then
- sens = "east"
- else
- sens = "west"
- end
- end
- If not (Yc == 0) then
- If (Yc < 0) then
- sens = "south"
- else
- sens = "north"
- end
- end
- return (sens)
- end
Advertisement
Add Comment
Please, Sign In to add comment