Datasheet

above. You don't need to worry about adding a NMEA checksum to your command either, the function will do this
automatically (or not, set add_checksum=False as a parameter and it will skip the checksum addition).
Now we can jump into a main loop that continually updates data from the GPS module and prints out status. The most
important part of this loop is calling the GPS update function:
Like the comments mention you must call updated every loop iteration and ideally multiple times a second. Each time
you call update it allows the GPS library code to read new data from the GPS module and update its state. Since the
GPS module is always sending data you have to be careful to constantly read data or else you might start to lose data
as buffers are filled.
You can check the has_fix property to see if the module has a GPS location fix, and if so there are a host of attributes
to read like latitude and longitude (available in degrees):
Notice some of the attributes like altitude_m are checked to be None before reading. This is a smart check to put in
your code too because those attributes are sometimes not sent by a GPS module. If an attribute isn't sent by the
module it will be given a None/null value and attempting to print or read it in Python will fail. The core attributes of
# Make sure to call gps.update() every loop iteration and at least twice
# as fast as data comes from the GPS unit (usually every second).
# This returns a bool that's true if it parsed new data (you can ignore it
# though if you don't care and instead look at the has_fix property).
gps.update()
if not gps.has_fix:
# Try again if we don't have a fix yet.
print('Waiting for fix...')
continue
# We have a fix! (gps.has_fix is true)
# Print out details about the fix like location, date, etc.
print('=' * 40) # Print a separator line.
print('Fix timestamp: {}/{}/{} {:02}:{:02}:{:02}'.format(
gps.timestamp_utc.tm_mon, # Grab parts of the time from the
gps.timestamp_utc.tm_mday, # struct_time object that holds
gps.timestamp_utc.tm_year, # the fix time. Note you might
gps.timestamp_utc.tm_hour, # not get all data like year, day,
gps.timestamp_utc.tm_min, # month!
gps.timestamp_utc.tm_sec))
print('Latitude: {} degrees'.format(gps.latitude))
print('Longitude: {} degrees'.format(gps.longitude))
print('Fix quality: {}'.format(gps.fix_quality))
# Some attributes beyond latitude, longitude and timestamp are optional
# and might not be present. Check if they're None before trying to use!
if gps.satellites is not None:
print('# satellites: {}'.format(gps.satellites))
if gps.altitude_m is not None:
print('Altitude: {} meters'.format(gps.altitude_m))
if gps.track_angle_deg is not None:
print('Speed: {} knots'.format(gps.speed_knots))
if gps.track_angle_deg is not None:
print('Track angle: {} degrees'.format(gps.track_angle_deg))
if gps.horizontal_dilution is not None:
print('Horizontal dilution: {}'.format(gps.horizontal_dilution))
if gps.height_geoid is not None:
© Adafruit Industries https://learn.adafruit.com/adafruit-ultimate-gps-featherwing Page 21 of 34