Modifications

Sauter à la navigation Sauter à la recherche
aucun résumé de modification
Ligne 3 : Ligne 3 :  
{{traduction}}
 
{{traduction}}
   −
{{ambox|text=Avant d'utiliser ampy avec un ESP8266, vous devez avoir désactivé la sortie de débogage (si nécessaire). Voyez la page [[FEATHER-CHARGER-FICHIER-MICROPYTHON-DEBUG|désact]]}}
+
{{ambox|text=Avant d'utiliser ampy avec un ESP8266, vous devez avoir désactivé la sortie de débogage (si nécessaire). Voyez la page [[FEATHER-CHARGER-FICHIER-MICROPYTHON-DEBUG|Désactiver la sortie
 +
DEBUG de l'ESP8266]]}}
   −
Using {{fname|ampy}} you can take Python code written on your computer and run it on a connected MicroPython board. This gives you a simple workflow for exploring MicroPython. Write code on your computer in your favorite text editor, then use ampy's '''run''' command to run it on a board!
+
En utilisant {{fname|ampy}}, vous pouvez prendre du code python écrit sur votre odrinateur et l'exécuter sur sur un carte MicroPython connectée en USB-Série. Cela permet d'explorer MicroPython en utilisant un flux de traitement assez simple. Vous pouvez écrire vitre code sur votre ordinateur, dans votre éditeur de texte favoris, puis utiliser ampy pour l'exécuter sur la carte!}}
   −
To use the '''run''' command just specify a path to a Python file on your computer.  Ampy will send the file to the board, wait for it to finish running, and print any output from the program.
+
Utilisez la commande '''{{fname|run}}''' (exécuter) et spécifiez simplement le chemin du fichier Python présent sur votre ordinateur, attendez la fin de son exécution, voyez les sorties (''instruction print')'') affichés par le programme.
   −
For example create a file '''test.py''' on your computer and save inside it the following Python code:
+
Créez le fichier d'exemple '''test.py''' sur votre ordinateur et copiez/collez y le code Pyhton suivant:
    
  <syntaxhighlight lang="python">
 
  <syntaxhighlight lang="python">
Ligne 17 : Ligne 18 :  
  </syntaxhighlight>
 
  </syntaxhighlight>
   −
In a terminal in the same directory as test.py run the following ampy command to execute the script on a connected MicroPython board:
+
Ouvrez un terminal et placez vous dans le même répertoire que votre fichier test.py. Exécutez ensuite la commande ampy suivante pour exécuter le script sur votre carte MicroPython connectée en USB-Séerie:
   −
  <nowiki>ampy --port /serial/port run test.py</nowiki>
+
  <nowiki>ampy --port /port/serie run test.py</nowiki>
   −
Where '''/serial/port''' is the path or name of the serial port connected to the MicroPython board.
+
'''/port/serie''' est le chemin (ou nom) du port série correspondant à votre carte MicroPython connectée sur le port USB de votre ordinateur. Sur une machine Lunix (ex: Linux Mint, dérivé d'Ubuntu) cela se présente sous la forme /dev/ttyUSB0
   −
   {{ambox|text=If you don't want to constantly specify the --port option you can set the AMPY_PORT environment variable in your terminal session and ampy will use it as the board's serial port.}}
+
   {{ambox|text=Si vous ne voulez pas préciser continuellement l'option --port dans la ligne de commande alors vous pouvez initialiser la variable d'envrionnement AMPY_PORT dans votre session terminal. Ampy utilisera automatiquement la valeur de la variable d'environnement si aucun port n'est précisé.}}
   −
You should see the output of the code after it was run on the board:
+
Après exécution de la commande, vous devriez voir les sortie du scripts sur votre moniteur:
    
{{ADFImage|FEATHER-CHARGER-FICHIER-MICROPYTHON-RUNCODE-00.png}}
 
{{ADFImage|FEATHER-CHARGER-FICHIER-MICROPYTHON-RUNCODE-00.png}}
   −
'''If you receive an error that ampy failed to receive the expected response be sure you disabled debug output as mentioned at the top of the page!'''  Also double check the board is connected to your computer and you are specifying the correct serial port for the board. Be sure the file test.py is in the same directory as you're running the ampy command too.
+
'''Si vous recevez une erreur stipulant que ampy n'a pas reçu la réponse attendue (''failed to receive the expected response'') c'est probablement parce que la sortie des message de débogage n'a pas été désactivé sur carte. Voyez le lien mentionné en haut de page!'''  Vérifiez également que votre carte est bien connéectée sur votre ordinateur et que vous avez spécifié correctement le port série de la carte. Finalement, assurez vous également que le fichier test.py se trouve bien dans le répertoire où vous vous trouvez (celui où vous allez exécuter ampy).
   −
'''Be aware the run command is not a shell or tool that allows you to send input from your computer to the board!''' If you need to send input you'll want to connect to the board and [[FEATHER-CHARGER-MICROPYTHON-SERIAL-REPL|use its serial REPL]].
+
'''Attention: la commande {{fname|run}} n'est pas un shell ou un outil qui permet d'envoyer des entrées (données) depuis l'ordinateur vers la carte!''' Si vous avez besoin d'envoyer des entrées/données vers la carte alors vous aurez besoin de connecter la carte et [[FEATHER-CHARGER-MICROPYTHON-SERIAL-REPL|d'utiliser le REPL Série]].
 +
 
 +
{{traduction}}
    
By default the run command will wait for the script to finish running on the board before printing its output.  In some cases you don't want this behavior--for example if your script has a main or infinite loop that never returns you don't want ampy to sit around waiting forever for it to finish.  In this case add the '''--no-output''' option to the run command.  This flag tells ampy not to wait for any output and instead just start running the script and return.
 
By default the run command will wait for the script to finish running on the board before printing its output.  In some cases you don't want this behavior--for example if your script has a main or infinite loop that never returns you don't want ampy to sit around waiting forever for it to finish.  In this case add the '''--no-output''' option to the run command.  This flag tells ampy not to wait for any output and instead just start running the script and return.
29 918

modifications

Menu de navigation