Ameba Arduino: [RTL8195AM] SDIO - Make directory in SD Card

Preparation

  • Ameba x 1
  • SD card or MicroSD card x 1
  • SD sniffer x 1 (optional)

Example

In this example, we show how to make a directory “testdir” under the root directory of the SD card, and create a new file in “testdir”.
Open the example in “File” -> “Examples” -> “AmebaSdFatFs” -> “create_folder”
Compile and upload to Ameba, then press the reset button.
Execution result screenshot:
1

 

In the screenshot we can see that first the directory “0:/testdir” is created (the “0:/ is the disk name of the SD card when it is mounted to Ameba”).

Next we create a new file in testdir “0:/testdir/test.txt”, and read the content of the file.

Code reference

The initialization can refer to previous examples.
Use mkdir() to create a directory, the argument requires the absolute path.
fs.mkdir(absolute_filename);

Next, create a new file with absolute path “0:/testdir/test.txt”.

SdFatFile file = fs.open(absolute_filename);
Copyrights ©瑞晟微电子(苏州)有限公司 2021. All rights reserved.
Please confirm that QQ communication software is installed