烟雾传感器 =================== .. figure:: /_static/products/ledong-module/static/图片/烟雾.png :width: 55% :align: center 概述 -------------------- 基于MQ-2气敏传感器,用于检测大气环境中烟雾、液化气、甲烷、丁烷灯气体浓度,气体浓度越大,AO输出越大。 技术参数 ------------------- 工作电压: VCC 3.3V -5V 模块尺寸:24*48mm 固定安装:2个兼容塑料积木通孔 数据类型:模拟采样值 引脚定义 ------------------- ===== ======== 引脚 定义 ===== ======== GND 地 VCC 电源 AO 模拟采样值 NC 空 ===== ======== 示例程序 ------------------- **特别提醒:传感器通电后,需要预热20S左右,测量的数据才稳定,传感器发热属于正常现象,因为内部有电热丝。** **掌控板OLED屏实时显示传感器测量的烟雾模拟值,同时当测量值大于2000时,掌控板RGB灯亮。** .. code-block:: python from mpython import * from bluebit import GasSensor gasSensor_0 = GasSensor(0) import time while True: oled.fill(0) oled.DispChar(str(str('烟雾模拟值: ') + str(gasSensor_0.get_raw_val())), 0, 0, 1) oled.show() if gasSensor_0.get_raw_val() > 2000: 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