I'm a beginner user with python and boards and I'm having some issues with my project. I'm using Teensy 4.1 (cpython 6.3.0 version) and I'd like to write data on a SD Card (Kingstone SDHC 16gb Class 10).
I checked out https://learn.adafruit.com/micropython- ... s?view=all to sort it out, but with bad results.
When I run the code to print the list of files or read a *.txt file everything works fine, but when I try to write on a *.txt file, [Errno 5] Input/output error occours.
Can anyone help please?
Code: Select all
SCLK_PIN = board.CLK
MOSI_PIN = board.CMD
MISO_PIN = board.DAT0
CS_PIN = board.DAT3
spi = bitbangio.SPI(SCLK_PIN, MOSI = MOSI_PIN, MISO = MISO_PIN)
cs = digitalio.DigitalInOut(CS_PIN)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
with open("/sd/test.txt", "w") as f:
f.write("This is another line!\r\n")