Outils pour utilisateurs

Outils du site


micropython

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
micropython [2020/02/24 16:25] – [Installation pour Linux] sergemicropython [2020/10/19 07:14] (Version actuelle) – Tag0 Removed: python3 serge
Ligne 1: Ligne 1:
 ====== Micropython ====== ====== Micropython ======
  
-{{ ::6298560.jpeg?200 |}}+{{ media_02:6298560.jpeg?200 |}}
  
  
Ligne 24: Ligne 24:
   * [[http://docs.micropython.org/en/latest/|docs.micropython.org/en]]   * [[http://docs.micropython.org/en/latest/|docs.micropython.org/en]]
   * [[https://docs.micropython.org/en/latest/pyboard/tutorial/reset.html|Reset]] pour revenir à l'état sortie usine   * [[https://docs.micropython.org/en/latest/pyboard/tutorial/reset.html|Reset]] pour revenir à l'état sortie usine
 +  * [[https://micropython-workshop.readthedocs.io/en/latest/pages/intro.html|MicroPython Workshop : des exemples dont le RGB LED Shield Lolin et +]]
 =====Installation pour Linux===== =====Installation pour Linux=====
   sudo apt install picocom   sudo apt install picocom
Ligne 64: Ligne 65:
 **Communication entre la PyBoard et le PC en USB** **Communication entre la PyBoard et le PC en USB**
  
-  * [[http://docs.micropython.org/en/latest/library/pyb.USB_VCP.html|The USB_VCP]] allows creation of a stream-like object representing the USB virtual comm port. It can be used to read and write data over USB to the connected host.+  * [[http://docs.micropython.org/en/latest/library/pyb.USB_VCP.html|The USB_VCP]] allows creation of a stream-like object representing the **USB Virtual Comm Port**. It can be used to read and write data over USB to the connected host.
   * [[https://forum.micropython.org/viewtopic.php?f=2&t=423&sid=6c4720ea85f2112b42bab2971b57003f|Une discussion sur forum.micropython.org]]   * [[https://forum.micropython.org/viewtopic.php?f=2&t=423&sid=6c4720ea85f2112b42bab2971b57003f|Une discussion sur forum.micropython.org]]
  
Ligne 129: Ligne 130:
 </code> </code>
  
-{{tag>micro_controleur python python3 sb}}+===== Entrée analogique pour capter un potentiomètre ===== 
 +  * https://micropython.fr/micropython/les_bases/entrees_analogiques 
 + 
 +Les broches analogiques sont: X1 à X8, X11, X12, Y11, Y12 
 + 
 +Les broches analogiques mesurent en 3.3V sur 12 bits (0-4095) soit une précision de 0,8 mV = 0.0008 V!  
 + 
 + 
 +=== ADC === 
 +  * [[https://docs.micropython.org/en/latest/pyboard/quickref.html#adc-analog-to-digital-conversion|analog to digital conversion]] 
 + 
 +<code python> 
 +See pyb.Pin and pyb.ADC. 
 + 
 +from pyb import Pin, ADC 
 + 
 +adc = ADC(Pin('X19')) 
 +adc.read() # read value, 0-4095 
 +</code> 
 + 
 +=== DAC === 
 +  * [[https://docs.micropython.org/en/latest/pyboard/quickref.html#dac-digital-to-analog-conversion|digital to analog conversion]] 
 +<code python> 
 +from pyb import Pin, DAC 
 + 
 +dac = DAC(Pin('X5')) 
 +dac.write(120) # output between 0 and 255 
 +</code> 
 + 
 + 
 +{{tag> micro_controleur python sb }} 
 + 
 + 
micropython.1582561530.txt.gz · Dernière modification : 2020/02/24 16:25 de serge