Skip to content

Commit 07d48aa

Browse files
committed
unify the datalogging example
1 parent d8e1f34 commit 07d48aa

File tree

2 files changed

+15
-36
lines changed

2 files changed

+15
-36
lines changed

examples/gps_computer_datalogging.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

examples/gps_datalogging.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Simple GPS datalogging demonstration.
22
# This example uses the GPS library and to read raw NMEA sentences
33
# over I2C or UART from the GPS unit and dumps them to a file on an SD card
4-
# (recommended) or internal storage (be careful as only a few kilobytes to
5-
# megabytes are available). Before writing to internal storage you MUST
6-
# carefully follow the steps in this guide to enable writes to the internal
7-
# filesystem:
4+
# (recommended), microcontroller internal storage (be careful as only a few
5+
# kilobytes are available), or to a filesystem.
6+
# If you are using a microcontroller, before writing to internal storage you
7+
# MUST carefully follow the steps in this guide to enable writes to the
8+
# internal filesystem:
89
# https://learn.adafruit.com/adafruit-ultimate-gps-featherwing/circuitpython-library
910
import board
1011
import busio
@@ -14,15 +15,16 @@
1415
# which means new lines are added at the end and all old data is kept.
1516
# Change this path to point at internal storage (like '/gps.txt') or SD
1617
# card mounted storage ('/sd/gps.txt') as desired.
17-
LOG_FILE = '/gps.txt' # Example for writing to internal path /gps.txt
18+
LOG_FILE = 'gps.txt' # Example for writing to internal path gps.txt
1819

1920
# File more for opening the log file. Mode 'ab' means append or add new lines
2021
# to the end of the file rather than erasing it and starting over. If you'd
2122
# like to erase the file and start clean each time use the value 'wb' instead.
2223
LOG_MODE = 'ab'
2324

24-
# If writing to SD card customize and uncomment these lines to import the
25-
# necessary library and initialize the SD card:
25+
# If writing to SD card on a microcontroller customize and uncomment these
26+
# lines to import the necessary library and initialize the SD card:
27+
# NOT for use with a single board computer like Raspberry Pi!
2628
"""
2729
import adafruit_sdcard
2830
import digitalio
@@ -42,6 +44,12 @@
4244
# These are the defaults you should use for the GPS FeatherWing.
4345
# For other boards set RX = GPS module TX, and TX = GPS module RX pins.
4446
uart = busio.UART(board.TX, board.RX, baudrate=9600, timeout=10)
47+
48+
# If using a USB/Serial converter, use pyserial and update the serial
49+
# port name to match the serial connection for the GPS!
50+
#import serial
51+
#uart = serial.Serial("/dev/ttyUSB0", baudrate=9600, timeout=10)
52+
4553
# If using I2C, we'll create an I2C interface to talk to using default pins
4654
#i2c = busio.I2C(board.SCL, board.SDA)
4755

0 commit comments

Comments
 (0)