IR Unit

Support the following products:

IR

Micropython Example:

 1import os, sys, io
 2import M5
 3from M5 import *
 4from unit import IRUnit
 5import time
 6
 7
 8ir_0 = None
 9
10
11def setup():
12    global ir_0
13
14    M5.begin()
15    Widgets.fillScreen(0x222222)
16
17    ir_0 = IRUnit((36, 26))
18
19
20def loop():
21    global ir_0
22    M5.update()
23    ir_0.tx(0, 0)
24    time.sleep(1)
25
26
27if __name__ == "__main__":
28    try:
29        setup()
30        while True:
31            loop()
32    except (Exception, KeyboardInterrupt) as e:
33        try:
34            from utility import print_error_msg
35
36            print_error_msg(e)
37        except ImportError:
38            print("please update to latest firmware")

UIFLOW2 Example:

example.png

ir_core_example.m5f2

class IRUnit

Constructors

class IRUnit(port)

Create an IRUnit object.

Parameters:

port (tuple) – The port to which the IR unit is connected. the tuple is a pair of values, the first value is the receive pin, and the second value is the transmit pin.

UIFLOW2:

init.png

Methods

IRUnit.tx()

Sends an ir signal value to an address.

UIFLOW2:

tx.png

IRUnit.rx_event()

Determine when the infrared signal is read and start to do some processing procedures.

UIFLOW2:

rx_event.png