Page 1 of 1

sd card mount check/os.mount problem

Posted: Sat May 28, 2022 5:04 am
by douglas.young
I am trying to write a datalogging program for a pi pico.

When I run the following code everything works fine:

import os, sdcard
import machine

sd = sdcard.SDCard(machine.SPI(1), machine.Pin(13))
try:
os.mount(sd, '/sd')
except OSError :
print('already mounted')

If I run it a second time, I do not get the print('already mounted') message to come up. Is there something else I should be doing to get to code to run other commands is the sd card is already mounted?

Thank,

Doug