Modifications

Sauter à la navigation Sauter à la recherche
1 427 octets ajoutés ,  1 juin 2021 à 21:27
Ligne 139 : Ligne 139 :  
</syntaxhighlight>
 
</syntaxhighlight>
    +
Vous pouvez éventuellement utiliser la bibliothèque '''ir_tx''' de Peter Inch (voir ci-dessous)
   −
{{underline|Ressources:}}
+
=== Receiving pulse ===
 +
 
 +
Peter Inch à fait un excellent travail avec sa [https://github.com/peterhinch/micropython_ir bibliothèque '''micropython_ir'''] .
 +
 
 +
Celle-ci fonctionne parfaitement avec MicroPython sur ESP32.
 +
 
 +
Le protocole NEC est l'un des plus répandus. Si vous avez une veille télécommande, il y a de fortes changes qu'elle utilise le protocole d'émission NEC.
 +
 
 +
<syntaxhighlight lang="python">
 +
MicroPython v1.15 on 2021-04-18; ESP32 module with ESP32
 +
Type "help()" for more information.
 +
>>>
 +
>>> from machine import Pin
 +
>>> from ir_rx.nec import NEC_8
 +
>>>
 +
>>> ir = NEC_8( Pin( 39, Pin.IN), callback )
 +
>>>
 +
>>> def callback( data, addr, ctrl ):
 +
...    if data < 0:
 +
...        print('Repeat code')
 +
...    else:
 +
...        print( 'Data {:02x} Addr {:04x}'.format(data,addr) )
 +
...
 +
>>> ir = NEC_8( Pin( 39, Pin.IN), callback )
 +
>>> Data 14 Addr 0000
 +
Repeat code
 +
Data 0a Addr 0000
 +
Repeat code
 +
Data 0a Addr 0000
 +
Repeat code
 +
Repeat code
 +
Repeat code
 +
Repeat code
 +
Repeat code
 +
Repeat code
 +
Data 18 Addr 0000
 +
Repeat code
 +
Data 19 Addr 0000
 +
Repeat code
 +
</syntaxhighlight>
 +
 
 +
Voici les protocoles supportés par la bibliothèque micropython_ir
 +
* from ir_rx.nec import NEC_8, NEC_16
 +
* from ir_rx.sony import SONY_12, SONY_15, SONY_20
 +
* from ir_rx.philips import RC5_IR, RC6_M0
 +
* from ir_rx.mce import MCE # Microsoft MCE remote control
 +
 
 +
=== Ressources ===
 
* [http://docs.micropython.org/en/v1.15/library/esp32.html#rmt Documentation Officielle du module RMT]
 
* [http://docs.micropython.org/en/v1.15/library/esp32.html#rmt Documentation Officielle du module RMT]
 
* [http://blog.bschwind.com/2016/05/29/sending-infrared-commands-from-a-raspberry-pi-without-lirc/ Excellent article bien documenté sur la réception et décodage de signaux IR sur un GPIO].
 
* [http://blog.bschwind.com/2016/05/29/sending-infrared-commands-from-a-raspberry-pi-without-lirc/ Excellent article bien documenté sur la réception et décodage de signaux IR sur un GPIO].
29 910

modifications

Menu de navigation