[RTL8722DM_MINI] SDFS - 资料编辑

材料准备

  • AmebaD[AMB23] x 1

  • MicroSD卡 x 1 (SD卡必须 < 32GB,格式设置为 fatfs)

步骤

SD文件系统模块支持SD卡数据操作。可以随时控制和查看文件,并将它们保存在非挥发性记忆体中。

将以下代码逐行复制粘贴到REPL中来使用。

1from machine import SDFS
2s=SDFS()                # create a short form
3s.create("ameba.txt")   # create a file named "ameba.txt"
4s.write("ameba.txt", "ameba supports sd card file system!") # write a string to the file just created
5s.read("ameba.txt")     # read the content from the same file
6s.rm("ameba.txt")       # delete the file

备注

不需要打开或关闭文件,API 会自动为您完成。