Modifications

Sauter à la navigation Sauter à la recherche
aucun résumé de modification
Ligne 2 : Ligne 2 :     
{{traduction}}
 
{{traduction}}
 +
 +
== Opérations sur fichiers ==
 +
In addition to running code {{fname|ampy}} you can also manipulate files on a MicroPython board's filesystem.  You can copy files from your computer to the board, read files from the board back to your computer, and even create and manage directories on the board.
 +
 +
Think of the filesystem on a MicroPython board like the filesystem on your computer.  Just like on your computer your board can have a complex hierarchy of directories with files and other subdirectories inside them.  MicroPython's filesystem is similar to Unix filesystems that separate parts of the path with forward slashes ('/') between parent directories.  For example a file '''/foo/bar.txt''' on a MicroPython board exists in a folder '''foo''' under the root of the board.
 +
 +
== Copier des fichiers sur la carte ==
 +
The '''put''' command can copy files from your computer to a MicroPython board.  This is great for copying over Python source code and other files you create on your computer.
 +
 +
For example to copy a file called '''test.py''' from your computer to the root of a MicroPython board's filesystem under '''/test.py''' run the following command:
 +
 +
<nowiki>ampy --port /serial/port put test.py</nowiki>
 +
 +
Where '''/serial/port''' is the path or name of the serial port connected to the MicroPython board.  Make sure '''test.py''' is in the same directory as you're running the command too.  If the file isn't there then specify the full path to it on your computer.
 +
 +
You can also put the file on the board in a path other than the root. Just specify as another argument the full path and filename to use on the board.  For example to copy a '''test.py''' from your computer to a file '''/foo/bar.py''' on the board run (note the parent foo directory must already exist!):
 +
 +
<nowiki>ampy --port /serial/port put test.py /foo/bar.py</nowiki>
 +
 +
{{ambox-stop|text=The put command will always overwrite files on the board without warning!}}
 +
 +
== Lire des fichiers depuis la carte ==
 +
{{traduction}}
 +
    
{{FEATHER-CHARGER-FICHIER-MICROPYTHON-TRAILER}}
 
{{FEATHER-CHARGER-FICHIER-MICROPYTHON-TRAILER}}
29 918

modifications

Menu de navigation