文章链接
微信扫一扫分享
NecIR模块中提供了与红外遥控相关的函数。
pin:引脚 Pin(0)、Pin(5)、Pin(9)、Pin(10)、Pin(14) Pin(15)、Pin(16)、Pin(17)、Pin(18)、Pin(19)、 Pin(21)、Pin(22)、Pin(23)、Pin(26)、Pin(27) 、 Pin(34)、Pin(35)、Pin(36) 、Pin(39)
示例:
from machine import NecIR, Pin ir = NecIR(Pin(0))
函数说明:设置红外回调函数。
hander:回调函数名称 回调函数定义格式: def <函数名>(addr, cmd): …… 其中,addr为红外地址码,cmd为红外命令码
def fun(addr,cmd): print('addr=', hex(addr)) print('cmd=', hex(cmd)) ir.read(fun)
使用道具 举报
本版积分规则 回复 回帖并转播 回帖后跳转到最后一页
© 2013-2025 Comsenz Inc. Powered by Discuz! X3.4 Licensed