人体感应 =================== .. figure:: /_static/products/ledong-module/static/图片/人体感应-H.png :width: 55% :align: center 概述 -------------------- 基于热释电红外传感器,能检测人或动物身体发射的红外线而输出电信号。 技术参数 ------------------- 工作电压: VCC 3.3V -5V 模块尺寸:24*48mm 固定安装:2个兼容塑料积木通孔 数据类型:触发--1 未触发--0 引脚定义 ------------------- ===== ======== 引脚 定义 ===== ======== GND 地 VCC 电源 DO 数字输出 NC 空 ===== ======== 示例程序 ------------------- **当有人接近触发人体感应传感器时,掌控板RGB灯亮。** .. code-block:: python from mpython import * p0 = MPythonPin(0, PinMode.IN) import time def boolean_P0(): return p0.read_digital() == 1 while True: if boolean_P0(): rgb.fill((int(255), int(0), int(0))) rgb.write() time.sleep_ms(1) time.sleep(1) else: rgb.fill( (0, 0, 0) ) rgb.write() time.sleep_ms(1) .. figure:: /_static/products/ledong-module/static/examples/人体感应.png :width: 100% :align: center