Updated daily cheer to use sdcardio
#
# REQUIREMENTS:
# should use M4 (or higher)
-# use CircuitPython 5.3.0+
+# use CircuitPython 6.0.0+
#
#
# HARDWARE:
@@ -43,7 +43,7 @@ import busio as io
import adafruit_pcf8523
# SD card
-import adafruit_sdcard
+import sdcardio
import storage
# NeoPixel
@@ -64,8 +64,7 @@ SD_CS = board.D10 # for M4
# Connect to the card and mount the filesystem.
spi = io.SPI(board.SCK, board.MOSI, board.MISO)
-cs = digitalio.DigitalInOut(SD_CS)
-sdcard = adafruit_sdcard.SDCard(spi, cs)
+sdcard = sdcardio.SDCard(spi, SD_CS)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
@@ -73,6 +72,7 @@ storage.mount(vfs, "/sd")
# Use the filesystem as normal! Our files are under /sd
# This helper function will print the contents of the SD
+
def print_directory(path, tabs=0):
for file in os.listdir(path):
stats = os.stat(path + "/" + file)
@@ -92,7 +92,7 @@ def print_directory(path, tabs=0):
prettyprintname += file
if isdir:
prettyprintname += "/"
- print('{0:<40} Size: {1:>10}'.format(prettyprintname, sizestr))
+ print("{0:<40} Size: {1:>10}".format(prettyprintname, sizestr))
# recursively print directory contents
if isdir:
