Example Code for MicroPython-TF Card
Last revision 2026/01/22
This example verifies if the TF card slot of the development board works. The sample program demonstrates how to read the file list from a TF card (insert a TF card first before use).
Hardware Preparation
Software Preparation
Sample Code
from machine import Pin, SDCard
import os
sd = SDCard(slot=0, width=4, sck=43, cmd=44, data=(39, 40, 41, 42), freq=40000000)
os.mount(sd, '/sd')
os.listdir('/sd')
print(os.listdir('/sd'))
os.listdir('/sd')
Result

Was this article helpful?
