Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local clock = os.clock
- function sleep(n)
- local t0 = clock()
- while clock() - t0 <= n do end
- end
- function getGPS()
- local f=fs.open("/data/homepos", "r")
- local tbl = textutils.unserialise (f.readAll())
- f.close()
- local curx, cury, curz = gps.locate(5)
- local distx = curx-tbl.x
- local disty = curx-tbl.y
- local distz = curx-tbl.z
- print ("x: "..distx)
- print ("y: "..disty)
- print ("z: "..distz)
- sleep(0.1)
- term.setCursorPos(1,1)
- term.clear()
- term.setCursorPos(1,1)
- end
- while true do
- getGPS()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement