Modifications

Sauter à la navigation Sauter à la recherche
Ligne 45 : Ligne 45 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
By using this '''Adafruit_M0_Express_CircuitPython''' class you'll get a filesystem object that is compatible with reading and writing files on a CircuitPython-formatted flash chip.  This is very important for interoperability between CircuitPython and Arduino as CircuitPython has specialized partitioning and flash memory layout that isn't compatible with simpler uses of the library (shown in the other examples).
+
En utilisant la classe '''Adafruit_M0_Express_CircuitPython''' vous obtenez un objet de type ''système de fichier'' compatible avec en lecture et écriture avec le formattage de la mémoire Flash de CircuitPython. C'est très important pour l'interopérabilité entre CircuitPython et Arduino étant donné que CircuitPython dispose d'un partitionnement spécifique et d'un agencement particulier de la mémoire flash qui n'est pas compatible avec des bibliothèque plus "simple" (que vous pourriez rencontrer dans les autres exemples).
   −
Once an instance of the '''Adafruit_M0_Express_CircuitPython''' class is created (called '''pythonfs''' in this sketch) you can go on to interact with it just like if it were the <a href="https://www.arduino.cc/en/Reference/SD">SD card library in Arduino</a>.  You can open files for reading & writing, create directories, delete files and directories and more.  Here's how the sketch checks if a '''boot.py''' file exists and prints it out a character at a time:
+
Une fois l'instance de la classe '''Adafruit_M0_Express_CircuitPython''' créée (instance appelée '''pythonfs''' dans le croquis) vous pouvez interagir avec elle comme s'il s'agissait de la [https://www.arduino.cc/en/Reference/SD bibliothèque carte SD d'Arduino].  Vous pouvez ouvrir des fichiers en lecture ou écriture, créer des répertoires, effacer des fichiers et répertoires et plus encore.
 +
 
 +
Voici un croquis qui vérifie la présence du fichier '''boot.py''' et affiche sont contenu (un caractère à la fois):
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
   // Check if a boot.py exists and print it out.
+
   // Vérifie sir le fichier boot.py existe puis affiche le contenu.
 
   if (pythonfs.exists("boot.py")) {
 
   if (pythonfs.exists("boot.py")) {
 
     File bootPy = pythonfs.open("boot.py", FILE_READ);
 
     File bootPy = pythonfs.open("boot.py", FILE_READ);
Ligne 61 : Ligne 63 :  
   }
 
   }
 
   else {
 
   else {
     Serial.println("No boot.py found...");
+
     Serial.println("Pas de fichier boot.py...");
 
   }
 
   }
 
</syntaxhighlight>
 
</syntaxhighlight>
29 917

modifications

Menu de navigation