IR

IR NEC Mode

This API is only applicable to the master device with integrated IR transmitter (eg: StickC/C Plus/ATOM LITE/MATRIX).

from m5stack import *

#send data
#ir.tx(addr, data)
ir.tx(111, 23)

IR Unit

If other masters need to add IR transceiver function, it can be realized by expanding the peripheral IR Unit , and use the following API.


import unit

ir0 = unit.get(unit.IR_NEC, unit.PORTA)

data = None
addr = None

#Receive Callback
def ir_nec_rx_cb(_data, _addr, _ctrl):
   global data, addr
   data = _data
   addr = _addr
   print(data)
   print(addr)

#Setup to receive Callback
ir0.rx_cb(ir_nec_rx_cb)

#send data
#ir.tx(addr, data)
ir.tx(111, 23)
On This Page