File system

The file system on the OpenMV has been briefly introduced in the 10-minute tutorial. Here are some details.

MicroPython’s file system is FatFS.

Root directory

Path takes root directory as the starting point.

When insert SD card, root directory is the SD card. If not, the root directory is the Flash internally installed.

When necessary,you can new a empty file: /flash/SKIPSD on SD car,which will prevent carrying SD card.Of course,you can use os.mount to carry SD card manually.

Absolute Path and Relative Path

Absolute path takes root directory as the starting point while relative path takes current directory as the starting point.\ For example:

image.save("/example.jpg")

The "/example.jpg" in the example is the absolute path. It will be stored in the root directory /.\ For example:

image.save("./pic/example.jpg")
image.save("pic/example.jpg")

These are relative paths,indicating file example.jpg of folder pic under current path.

MicroPython’s File I/O

http://www.cnblogs.com/feeland/p/4477535.html

OS Module of MicroPython

In code,you can use bank os to carry on newing catalog or something like new file.

  • os.listdir([dir])\ Without parameter,you ought to list current directory.Given parameter,you ought to list the catalog represented by parameter.

  • os.chdir(path)\ Changing current directory.

  • os.getcwd()\ Gaining current directory.

  • os.mkdir(path)\ Newing a new director

  • os.remove(path)\ Deleting file.

  • os.rmdir(path)\ Deleting directory.

  • os.rename(old_path, new_path)\ Rechristening file.

  • os.stat(path)\ Get the status of a file or path

Default file of OpenMV

In default situation,there are three files in the disk ofOpenMV.

  • main.py\ Power-on self-run the code of this file.

  • openmv.inf\ Windows driver file.

  • README.txt\ To little avail,you can have a look at it.

results matching ""

    No results matching ""