Modifications

Sauter à la navigation Sauter à la recherche
1 116 octets ajoutés ,  19 février 2022 à 21:27
Ligne 165 : Ligne 165 :  
[[Fichier:ENG-CANSAT-PICO-THONNY-10.png|480px]]
 
[[Fichier:ENG-CANSAT-PICO-THONNY-10.png|480px]]
   −
Le Plotter reprend les données numériques affichée dans session REPL.  
+
The Plotter catch the numeric values sends/print in the REPL/Shell and displays it in the chart.  
   −
Lorsque la ligne contient exclusivement une valeur numérique, celle-ci est reprise dans le plotter.
+
Only lines containing numeric values are used by the plotter.
   −
Dans l'exemple suivant, nommé {{fname|demo2.py}}, utilise une fonction gamma pour faire pulser la LED de statut sur le GPIO. C'est qu'une progression proportionnel du signal PWM ne produit pas une évolution proportionnelle de la luminosité de la LED (voir livre [https://www.editions-eni.fr/livre/micropython-et-pyboard-python-sur-microcontroleur-de-la-prise-en-main-a-l-utilisation-avancee-9782409022906 MicroPython et Pyboard, Edition ENI], in French).
+
On the following example, named {{fname|demo2.py}}, we do use the gamma function to make the LED pulsing in a more natural way. Indeed, a progressive PWM signal increase would not offers a proportional luminosity increase on the LED (voir livre [https://www.editions-eni.fr/livre/micropython-et-pyboard-python-sur-microcontroleur-de-la-prise-en-main-a-l-utilisation-avancee-9782409022906 MicroPython et Pyboard, Edition ENI], in French).
   −
La correction gamma permet de corriger cet inconvénient de non proportionnalité.
+
We do use the {{fname|gamma()}} function to rectify the apparent proportionality between the PWM and emitted light.
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 194 : Ligne 194 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Ce qui produit le résultat suivant dans Thonny.
+
Which produce the following results in Thonny and activated Plotter.
 
  −
La valeur numérique produite dans la session REPL est également reproduite dans le Plotter.
      
[[Fichier:ENG-CANSAT-PICO-THONNY-11.png|480px]]
 
[[Fichier:ENG-CANSAT-PICO-THONNY-11.png|480px]]
Ligne 202 : Ligne 200 :  
'''{{underline|Drawing several curves}}'''
 
'''{{underline|Drawing several curves}}'''
   −
En modifiant un peu le code du script, il est possible de retourner la valeur PWM sans correction gamma et avec correction gamme. En encodant ces valeurs dans un tuple, le plotter peut alors dessiner plusieurs courbes.
+
By modifying the script, we can return the PWM value and the gamma corrected value by using a [https://www.w3schools.com/python/python_tuples.asp Python tuple]. Then the plotter will draw several curves.
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 227 : Ligne 225 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Ce qui produit le résultat suivant dans Thonny.
+
Which produce the following results in Thonny.
    
[[Fichier:ENG-CANSAT-PICO-THONNY-12.png|480px]]
 
[[Fichier:ENG-CANSAT-PICO-THONNY-12.png|480px]]
   −
Le lecteur notera que les données sont retournée sous forme d'un tuple (pwm, pwm_gamma) . Par conséquent, la première valeur est la courbe proportionnelle et la seconde la courbe corrigée.  
+
As seen in the REPL/Shell output, the data are return under the format (pwm, pwm_gamma) . The first value is the proportional curve and the second value the gamma fixed value.  
   −
Le graphique du Plotter indique, dans son coin inférieur droit, quel est la couleur correspondante à la position de la donnée dans le tuple.
+
The plotter does show the curve correspondence between tuple value position and drawed curve (see to bottom right corner).
   −
== System Shell - Pure ==
+
== System Shell - Pure REPL ==
Il est également possible de démarrer une session REPL avec la plateforme MicroPython dans un vrai terminal (donc sans passer par le volet "Shell" de Thonny.
+
It is also possible to start a Pure REPL session inside an external terminal. By using a external terminal, the user escape from the Thonny shell panel and being directly connected to the microcontroler via an USB serial connection.
   −
Le menu "'''Tools | Open System Shell..'''" ouvre une fenêtre terminal.
+
The "'''Tools | Open System Shell..'''" menu will open the terminal Window.
    
[[Fichier:ENG-CANSAT-PICO-THONNY-20.png|640px]]
 
[[Fichier:ENG-CANSAT-PICO-THONNY-20.png|640px]]
  −
Cela permet, par exemple, d'interagir directement avec le REPL de la plateforme MicroPython sans couche logiciel intermédiaire (celle de Thonny).
      
{{underline|Notes:}}
 
{{underline|Notes:}}
* Thonny doit être connecté sur la plateforme MicroPython pour que cette fonctionnalité fonctionne correctement.  
+
* Thonny must be connected to the target plateform to be able to open the External Terminal.  
* Le gestionnaire de fichiers permet de voir facilement si Thonny est connecté ou non sur la carte MicroPython.
+
* The file manager can helps to check, whether or not, when Thonny is connected to the MicroPython board.
* Il n'est pas possible d'ouvrir deux sessions terminal en même temps sur le microcontrôleur MicroPython.
+
* It is not possible to open two terminal session (at the same time) to the MicroPython microcontroler.
    
== File manager ==
 
== File manager ==
   −
xxx
+
It is common to copy library/libraries on the board.
 +
 
 +
This will requires to '''transfer one (or several) files to the MicroPython board'''.
 +
 
 +
Such '''libraries''' are usually python scripts (eg: ce [https://raw.githubusercontent.com/mchobby/esp8266-upy/master/bme280-bmp280/bme280.py bme280.py file]) coded for target sensors (eg: [https://github.com/mchobby/esp8266-upy/tree/master/bme280-bmp280 BME280 atmospheric & temperature I2C sensor]).
 +
 
 +
Thank to Thonny you also have a dedicated "file manager" tool used to transfert files between the computer and the MicroPython board.
 +
 
 +
The file manager is available via the "'''View | Files'''" menu.
    
[[Fichier:ENG-CANSAT-PICO-THONNY-30.png|480px]]
 
[[Fichier:ENG-CANSAT-PICO-THONNY-30.png|480px]]
 +
 +
Which would display the Thonny file manager.
 +
 +
[[Fichier:ENG-CANSAT-PICO-THONNY-31.png|480px]]
 +
 +
To transfer a file from the computer to the MicroPython board, you will need to :
 +
* Select the file into the "Computer" pane
 +
* Activate the contextual menu (mouse right click)
 +
* Select the option "Upload to" in the menu
 +
 +
{{ambox|text=The "/" drawed into the menu match the root folder on the target (the microcontroler in this case).}}
 +
 +
[[Fichier:ENG-CANSAT-PICO-THONNY-32.png|480px]]
 +
 +
It would be easy to identify the features and behavior of the file manager by exploring and testing the various entries in the contextual menu. Please note that contectual menu are different in the board pane and computer pane.
    
{{ENG-CANSAT-PICO-TRAILER}}
 
{{ENG-CANSAT-PICO-TRAILER}}
29 917

modifications

Menu de navigation