[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 會自動為您完成。