[RTL8722DM_MINI] SDFS - Data Editing

Materials

  • AmebaD[AMB23] x 1

  • MicroSD Card x 1 (SD card must be < 32GB with format set to fatfs)

Steps

SD File System module supports SD card data manipulation in the form of file. With it, you can control and inspect files as you like and keep them on non-volatile memory.

Copy and paste the following code line by line into REPL to see its effect.

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

Note

No file open or close is needed, the API does that automatically for you.