I’m looking for a way to check if a SD card is available in slot (via SPI) before I send data do save in it.
Till now, I’m using:
try: ww.write(data, sync = True) except: mmc_card = False ww.close()
but this is not working.
The device saves data periodically in SD. I want to check if an error occurred after the file is open. Explaining better: if an error occurs in SD, the device will not try to save data anymore and send an alert to the user.
Is there a better way?