红外接收 =================== .. figure:: /_static/products/ledong-module/static/图片/红外接收-H.png :width: 55% :align: center 概述 -------------------- 可用于接收红外遥控信号,有效距离8米。 技术参数 ------------------- 工作电压: VCC 3.3V -5V 模块尺寸:24*48mm 固定安装:2个兼容塑料积木通孔 数据类型:触发--1 未触发--0 接收距离:8m 引脚定义 ------------------- ===== ======== 引脚 定义 ===== ======== GND 地 VCC 电源 DO 数字输出 NC 空 ===== ======== 示例程序 ------------------- 1.串口波特率设置115200bps。程序在定义串口引脚时,注意模块端的RX、TX需要和主板上的RX、TX交叉! 2.当接收到红外调制信号,模块上的指示灯会闪烁。 **图形化代码** .. code-block:: python from mpython import * from ir_remote import IRDecode remote = IRDecode(Pin.P0) def remote_callback(_address, _command): global re oled.fill(0) oled.DispChar(str(str('接收内容: ') + str(_command)), 0, 0, 1) oled.DispChar(str(str('回调地址: ') + str(_address)), 0, 16, 1) oled.show() remote.set_callback(remote_callback) .. figure:: /_static/products/ledong-module/static/examples/红外接收.png :width: 100% :align: center