Advertisement
silver2row

Python3 and GPSd and GPS

Apr 25th, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import gps3; print(gps3.__file__)
  4. from gps3 import gps3
  5.  
  6. gps_socket = gps3.GPSDSocket()
  7. data_stream = gps3.DataStream()
  8. gps_socket.connect()
  9. gps_socket.watch()
  10.  
  11. for new_data in gps_socket:
  12.     if new_data:
  13.         data_stream.unpack(new_data)
  14.         print(" --- ")
  15.         for key, value in data_stream.TPV.items():
  16.             print( "%s: %s" % (key, value) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement