Skip to content

Commit 2cab6bd

Browse files
authored
Changed code to use sdcardio as preferred method
1 parent b0a4b6c commit 2cab6bd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

examples/gps_datalogging.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,24 @@
2929
# lines to import the necessary library and initialize the SD card:
3030
# NOT for use with a single board computer like Raspberry Pi!
3131
"""
32-
import adafruit_sdcard
33-
import digitalio
32+
# Comment out if your board doesn't support sdcardio
33+
import sdcardio
34+
35+
# Uncomment if your board doesn't support sdcardio
36+
#import adafruit_sdcard
37+
#import digitalio
38+
3439
import storage
3540
3641
SD_CS_PIN = board.D10 # CS for SD card using Adalogger Featherwing
3742
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
38-
sd_cs = digitalio.DigitalInOut(SD_CS_PIN)
39-
sdcard = adafruit_sdcard.SDCard(spi, sd_cs)
43+
# Comment out if your board doesn't support sdcardio
44+
sdcard = sdcardio.SDCard(spi, SD_CS_PIN)
45+
46+
# Uncomment if your board doesn't support sdcardio
47+
#sd_cs = digitalio.DigitalInOut(SD_CS_PIN)
48+
#sdcard = adafruit_sdcard.SDCard(spi, sd_cs)
49+
4050
vfs = storage.VfsFat(sdcard)
4151
storage.mount(vfs, '/sd') # Mount SD card under '/sd' path in filesystem.
4252
LOG_FILE = '/sd/gps.txt' # Example for writing to SD card path /sd/gps.txt

0 commit comments

Comments
 (0)