The SD.open() function opens a file on the SD card. In the case the file is opened for writing, a new file will be created if it doesn't already exist (but the directory containing it must already exist).
- filename: the name the file to open, which can include directories (delimited by forward slashes, /). Allowed type: char * or String
- mode: (optional) the mode in which to open the file. If it is not set, the defaults value is FILE_READ. The mode can be one of the following values:
- FILE_READ: open the file for reading, starting at the beginning of the file.
- FILE_WRITE: open the file for reading and writing, starting at the end of the file.
- The filename should follows 8.3 filename convention. If not, it may fails to open.
- If a file is not closed before openning it again, it may fails to open.
※ NOTES AND WARNINGS:
- A File object referring to the opened file. If the file couldn't be opened, this object will evaluate to false in a boolean context. For example, you can test the return value with if statement.