Différences entre versions de « FEATHER-CHARGER-FICHIER-MICROPYTHON »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 22 : Ligne 22 :
  
 
* [[FEATHER-CHARGER-MICROPYTHON|Les bases de MicroPython: Charger MicroPython sur une carte]]
 
* [[FEATHER-CHARGER-MICROPYTHON|Les bases de MicroPython: Charger MicroPython sur une carte]]
 +
 +
= Ampy vs RShell =
 +
Avant la traduction de ce tutoriel, nous avions découvert et utilisé '''[https://github.com/dhylands/rshell rshell]'''.
 +
 +
C'est un outil plus complet que Ampy et donc aussi plus complexe. Cependant, l'investissement en vaut vraiment la chandelle.
 +
 +
Nous en recommandons donc chaudement l'usage... surtout qu'il est bien indiqué avec le {{pl|846|Feather ESP8266 Huzza}} à condition de réduire la taille du buffer d'échange.
 +
 +
<nowiki>rshell --port /dev/ttyUSB0 --baud 115200 --buffer-size 128 --editor nano</nowiki>
 +
 +
{{ambox-stop|text=Il est impératif de réduire la taille du buffer à 128 octets sur un ESP8266 sinon vous risquez d'écraser le système de fichier votre ESP8266... auquel cas il faudra reflasher votre carte}}
 +
 +
Nous avons également un petit script shell [https://github.com/mchobby/esp8266-upy/blob/master/rshell-esp8266.sh rsheel-esp8266.sh] pour faciliter faciliter le démarrage de rshell pour un esp8266.
  
 
{{FEATHER-CHARGER-FICHIER-MICROPYTHON-TRAILER}}
 
{{FEATHER-CHARGER-FICHIER-MICROPYTHON-TRAILER}}

Version du 8 novembre 2016 à 21:48


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

This guide explores how to load files and run code on a MicroPython board. In the earlier introductions to MicroPython you manually typed all the code you wanted to run into the board's serial REPL. This process is great for learning and experimenting, but not great for developing and running complex programs because you have to type in the program every time you want it to run. However MicroPython has an internal filesystem which can store code that's run whenever the board powers up, just like an Arduino runs an Arduino sketch. Using a simple tool you can learn how to load code and other files into MicroPython's filesystem and enable an 'Arduino-like' workflow for developing code on your computer that runs on a MicroPython board.

Before you get started be sure to check your board's documentation for more details on its filesystem. Some MicroPython boards like the pyboard have a microSD card which can store large amounts of data in its filesystem. Other boards like the ESP8266 reserve just a small part of their internal flash memory for the filesystem. Each board is slightly different in how it creates and uses its filesystem so check your board's documentation for more details.

For this guide we'll use the Adafruit MicroPython tool (ampy) to load files and run code on a MicroPython board. If you're curious ampy is not the only tool for manipulating files and more on a MicroPython board, there are several other tools such as:

  • ESP8266 web REPL - For ESP8266-based boards the web REPL provides a basic web interface for uploading files to the board. This is handy for dropping a file on a board, but it requires being connected to the web REPL which might not always be convenient.
  • rshell - rshell is a remote MicroPython shell tool which allows you to access the files and more from a MicroPython board connected over its serial/USB connection. Check out the rshell forum post for more details on its usage.
  • mpfshell - mpfshell is similar to rshell and provides file and REPL access in a MicroPython-specific shell. However mpfshell is made specifically to support ESP8266-based boards and the WiPy board. Check out the mpfshell forum post for more details on its usage.

Before continuing make sure you have a MicroPython board and can access its serial REPL. If you're new to MicroPython start by reading these guides that explain what it is and how to get started:

Ampy vs RShell

Avant la traduction de ce tutoriel, nous avions découvert et utilisé rshell.

C'est un outil plus complet que Ampy et donc aussi plus complexe. Cependant, l'investissement en vaut vraiment la chandelle.

Nous en recommandons donc chaudement l'usage... surtout qu'il est bien indiqué avec le Feather ESP8266 Huzza à condition de réduire la taille du buffer d'échange.

rshell --port /dev/ttyUSB0 --baud 115200 --buffer-size 128 --editor nano

Nous avons également un petit script shell rsheel-esp8266.sh pour faciliter faciliter le démarrage de rshell pour un esp8266.


Source: MicroPython Basics: Load Files & Run Code
Créé par Tony DiCola pour AdaFruit Industries.

Traduit par Meurisse D. pour MCHobby

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com