Another way of executing code on the pyboard is to use the {{fname|pyboard.py}} script available in the tools directory of the MicroPython git repository. Exit minicom with Ctrl-A X, then load your file onto the pyboard with pyboard.py file_to_load.py. You can connect to the REPL by launching minicom again.
+
{{ambox|text=
−
You can modify the pyboard.py script to find the pyboard device automatically by changing the beginning of the main function as follows:
+
Une autre façon d’exécuter du code sur votre pyboard est d'utiliser le script {{fname|pyboard.py}} disponible dans le répertoire ''tools'' du dépôt GIT MicroPython.
+
+
Plutôt que d'utiliser minicom pour transférer un fichier sur la PyBoard, vous pouvez utiliser directement le script {{fname|pyboard.py}}. Rien ne vous empêche, par la suite, de réutiliser un programme terminal (comme minicom) pour vous reconnecter à nouveau en mode REPL.
+
+
Vous pouvez modifier le script {{fname|pyboard.py}} pour rechercher automatiquement le périphérique "pyboard" en modifiant la fonction {{fname|main()}} comme suit:
<nowiki>def main():
<nowiki>def main():
Ligne 93 :
Ligne 97 :
cmd_parser.add_argument('--device', default='/dev/' + ttymodems[0], help='the serial device of the pyboard')</nowiki>
cmd_parser.add_argument('--device', default='/dev/' + ttymodems[0], help='the serial device of the pyboard')</nowiki>
−
An already patched version (may not be up to date with respect to the git repository) [http://wdi.supelec.fr/boulanger/downloads/MicroPython/pyboard.py is available].
+
Si vous désirez utiliser le script original du script {{fname|pyboard.py}}, la commande à utiliser pour charger votre fichier "mon_fichier.py" sur ma pyboard est {{fname|./pyboard --device=/dev/ttyACM1 mon_fichier.py}} . /dev/ttyACM1 correspond à la connexion série associée à votre PyBoard.
−
−
Si vous desirez utiliser le script original du script, la commande à utiliser pour charger votre fichier mon_fichier.py sur ma pyboard est {{fname|./pyboard --device=/dev/ttyACM1 mon_fichier.py}} . /dev/ttyACM1 correspond à la connexion série associée à votre PyBoard.