Damien George 7d28789544 ports: Use vfs module instead of os.
Signed-off-by: Damien George <damien@micropython.org>
2024-02-07 13:25:09 +11:00

37 lines
821 B
Python

"""
Example for pca10040 / nrf52832 to show how mount
and list a sdcard connected over SPI.
Direct wiring on SD card (SPI):
______________________________
| \
| 9. | NC | \
| 1. | ~CS | |
| 2. | MOSI | |
| 3. | GND | |
| 4. | VCC3.3| |
| 5. | SCK | |
| 6. | GND | |
| 7. | MISO | |
| 8. | NC | |
| |
---------------------------------
"""
import os, vfs
from machine import SPI, Pin
from sdcard import SDCard
def mnt():
cs = Pin("P22", mode=Pin.OUT)
sd = SDCard(SPI(0), cs)
vfs.mount(sd, "/")
def list():
files = os.listdir()
print(files)