Modifications

Sauter à la navigation Sauter à la recherche
aucun résumé de modification
Ligne 5 : Ligne 5 :     
Ces fichiers contiennent du code MicroPython qui sera exécuté lorsque la carte est mise sous-tension ou réinitialisée (en pressant le bouton "reset"). Ces fichiers sont:
 
Ces fichiers contiennent du code MicroPython qui sera exécuté lorsque la carte est mise sous-tension ou réinitialisée (en pressant le bouton "reset"). Ces fichiers sont:
* {{fname|/boot.py}}: Ce fichier est le {{underline|premier}} à être exécuté lorsque la carte est mise sous-tension (ou réinitialisée). Il doit contenir du code de bas niveau qui sera exécuté pour achever la séquence de boot/démarrage de la carte. You typically don't need to modify boot.py unless you're customizing or modifying MicroPython itself. However it's interesting to look at the contents of the file to see what happens when the board boots up. Remember you can use the ampy '''get''' command to read this and any other file!
+
* {{fname|/boot.py}}: Ce fichier est le {{underline|premier}} à être exécuté lorsque la carte est mise sous-tension (ou réinitialisée). Il doit contenir du code de bas niveau qui sera exécuté pour achever la séquence de boot/démarrage de la carte. Il n'est habituellement pas nécessaire de modifier {{fname|boot.py}} à mois d'avoir besoin de personnaliser ou modifier MicroPython. Il est intéressant de prendre connaissance du contenu de ce fichier pour en apprendre plus sur la séquence de boot d'une carte. Vous pouvez utiliser la commande {{fname|get}} de ampy pour voir facilement le contenu de ce fichier!
* {{fname|/main.py}} - If this file exists it's run '''after''' boot.py and should contain any main script that you want to run when the board is powered up or reset.
+
* {{fname|/main.py}}: Si ce fichier existe, sont contenu est exécuté {{underline|après}} le fichier boot.py . Ce fichier devrait contenir votre script principal (celui à exécuter automatiquement au démarrage de la carte). Exactement comme pour un croquis Arduino qui est exécuté automatiquement lorsque la carte est mise sous tension..<br />Ecrivez un fichier {{fname|main.py}} sur une carte MicroPython et son contenu sera automatiquement exécuté à la mise sous tension.
   −
The {{fname|main.py}} script is what you can use to have your own code run whenever a MicroPython board powers up.  Just like how an Arduino sketch runs whenever the Arduino board has power, writing a {{fname|main.py}} to a MicroPython board will run that code whenever the MicroPython board has power.
+
Vous pouvez éditer le contenu du fichier {{fname|main.py}} et {{fname|boot.py}} en utilisant [[FEATHER-CHARGER-FICHIER-MICROPYTHON-FILEOP|les opérations sur fichier proposés par ampy]].  
   −
You can create and edit the {{fname|main.py}} on a board [[FEATHER-CHARGER-FICHIER-MICROPYTHON-FILEOP|using the file operations in ampy]].  For example create a {{fname|test.py}} on your computer and put the following Python code inside it:
+
Par exemple, nous allons créer un fichier {{fname|test.py}} sur notre ordinateur et copier le contenu suivant à l'intérieur:
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 29 : Ligne 29 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Then copy the file to {{fname|/main.py}} on a connected MicroPython board with '''ampy's''' put command:
+
Nous allons ensuite copier le contenu de test.py dans le fichier {{fname|/main.py}} de notre carte MicroPython avec la commande {{fname|put}} de ampy:
   −
  <nowiki>ampy --port /serial/port put test.py /main.py</nowiki>
+
  <nowiki>ampy --port /port/serie put test.py /main.py</nowiki>
    
Reset the board or unplug it and plug it back in, then connect to the serial REPL and notice the board is counting numbers!  The {{fname|main.py}} code started as soon as the board finished booting.
 
Reset the board or unplug it and plug it back in, then connect to the serial REPL and notice the board is counting numbers!  The {{fname|main.py}} code started as soon as the board finished booting.
29 918

modifications

Menu de navigation