Différences entre versions de « FEATHER-CHARGER-FICHIER-MICROPYTHON-FILEOP »
(Page créée avec « {{FEATHER-CHARGER-FICHIER-MICROPYTHON-NAV}} {{traduction}} {{FEATHER-CHARGER-FICHIER-MICROPYTHON-TRAILER}} ») |
|||
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}} |
Version du 8 novembre 2016 à 22:41
En cours de traduction/élaboration. |
Opérations sur fichiers
In addition to running code 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:
ampy --port /serial/port put test.py
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!):
ampy --port /serial/port put test.py /foo/bar.py
The put command will always overwrite files on the board without warning! |
Lire des fichiers depuis la carte
En cours de traduction/élaboration. |
Source: MicroPython Basics: Load Files & Run Code
Créé par Tony DiCola pour AdaFruit Industries.
Traduit par Meurisse D. pour MCHobby
Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : « Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.
L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.
Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com