The first time I mount the SD it works , but if I try running a second time without a Ctrl D and full power down I get this error.
>>> %Run -c $EDITOR_CONTENT
['System Volume Information', 'Hello.txt']
Hello this is just a test
>>> %Run -c $EDITOR_CONTENT
E (154919) spi: SPI3 already claimed by spi master.
Traceback (most recent call last):
File "<stdin>", line 6, in <module>
OSError: 259
>>>
Code: Select all
from machine import SDCard, Pin , SPI
import time
import os
import machine
os.mount(machine.SDCard(slot=2), "/sd")
os.chdir('/sd')
print(os.listdir('/sd'))
print(open("/sd/Hello.txt", "r").read())
os.umount('/sd')