Created
February 9, 2015 18:19
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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