File System

InQuickstart in 10 minutes it has simply introduced the file sysytem on OpenMV.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")

Is absolute path,which will be placed under 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 directory.

  • os.remove(path)
    Deleting file.

  • os.rmdir(path)
    Deleting directory.

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

  • os.stat(path)
    Gaining the state of 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.

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

results matching ""

    No results matching ""