Modifications

Sauter à la navigation Sauter à la recherche
367 octets ajoutés ,  10 novembre 2016 à 21:05
aucun résumé de modification
Ligne 4 : Ligne 4 :  
{{ADFImage|FEATHER-CHARGER-MODULE-IMPORT.jpg}}
 
{{ADFImage|FEATHER-CHARGER-MODULE-IMPORT.jpg}}
   −
Extending your scripts by including code from other files is a great way to simplify and structure programs. Instead of constantly reinventing the wheel for mundane tasks you can put code for them in a Python module or package once and then reuse that code in other scripts. This way you can focus on what's important for your project instead of reimplementing trivial details. Even better by creating modules and packages you can share your code with others so they can benefit from it too!
+
Etendre vos scripts en incluant du code provenant d'autres fichiers est une excellente approche pour simplifier et structurer vos programmes. Au lieu de continuellement réinventer la roue pour les tâches courantes, il est possible de placer du code ''récurrent'' dans des modules Python ou des paquets Python (''Package'' en anglais). Vous pourrez ensuite réutiliser ce code récurrent dans vos autres scripts. De cette façon, vous pourrez vous concentrer sur les éléments importants de votre projet (au lieu de ré-implémenter des élément triviaux). Mieux encore, avec des modules et paquets Python, vous avez la possibilité de partager votre code avec les autres Makers!
   −
With MicroPython you can import code in two ways. One easy way is from Python files on a board's filesystem just like you would import Python modules & packages on the desktop.  A second way is with 'frozen modules' that are baked-in to a build of MicroPython's firmware and reduce the memory usage of a module vs. importing its raw Python source.  This guide explores how to import modules & packages as both raw Python source files and frozen modules for maximum efficiency.
+
Vous pouvez importer du code de deux façons différentes avec MicroPython. Une façon simple est de le faire depuis des fichiers Python stockés dans le système de fichier de la carte. Vous pourrez les importer comme vous le verriez avec n'importe quel module et paquet/''package'' Python standard. Une seconde option est d'utiliser des 'modules Frozen' (A second way is with 'frozen modules' that are baked-in to a build of MicroPython's firmware and reduce the memory usage of a module vs. importing its raw Python source.  This guide explores how to import modules & packages as both raw Python source files and frozen modules for maximum efficiency.
    
Before you get started you'll want to have a board running MicroPython and be familiar with its basic usage like the serial REPL.  In addition for frozen modules you'll need to be familiar with building the MicroPython firmware for your board which is somewhat of an advanced topic.  Check out the following guides:
 
Before you get started you'll want to have a board running MicroPython and be familiar with its basic usage like the serial REPL.  In addition for frozen modules you'll need to be familiar with building the MicroPython firmware for your board which is somewhat of an advanced topic.  Check out the following guides:
29 917

modifications

Menu de navigation