Skip to content

Instantly share code, notes, and snippets.

@developius
Created February 9, 2015 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save developius/4c46b59bde785fb02081 to your computer and use it in GitHub Desktop.
Save developius/4c46b59bde785fb02081 to your computer and use it in GitHub Desktop.
Code from http://thenerdcompany.blogspot.co.uk/2013/12/demystifying-ublox-6-gps-module.html for reading GPS values with a Raspbery Pi
import serial
from pynmea import nmea
ser = serial.Serial("/dev/ttyAMA0",9600)
gpgga = nmea.GPGGA()
while 1:
data = ser.readline()
if (data.startswith('$GPGGA')):
gpgga.parse(data)
print("Lat: ", gpgga.latitude
print("Long: ", gpgga.longitude
print("Alt: ", gpgga.antenna_altitude, " ", gpgga.altitude_units
print("No of sats: ", gpgga.num_sats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment