{"id":102919,"date":"2026-09-09T17:33:53","date_gmt":"2026-09-09T09:33:53","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/102919.html"},"modified":"2026-09-09T17:33:53","modified_gmt":"2026-09-09T09:33:53","slug":"%e5%bd%93-stm32-%e9%81%87%e4%b8%8a%e5%8f%af%e7%87%83%e6%b0%94%e4%bd%93%e6%b3%84%e6%bc%8f%ef%bc%9a%e4%b8%80%e5%9c%ba%e5%85%b3%e4%ba%8e-mq-5-%e6%b0%94%e4%bd%93%e4%bc%a0%e6%84%9f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/102919.html","title":{"rendered":"\u5f53 STM32 \u9047\u4e0a\u201c\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u201c\uff1a\u4e00\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u786c\u6838\u53c8\u6c99\u96d5\u7684\u5192\u9669"},"content":{"rendered":"<h3>&#x1f525; \u4e00\u3001\u4e3a\u4ec0\u4e48\u6211\u8981\u8ddf&#034;\u770b\u4e0d\u89c1\u7684\u654c\u4eba&#034;\u8f83\u52b2&#xff1f;<\/h3>\n<p>\u5404\u4f4d\u770b\u5b98&#xff0c;\u4e14\u542c\u6211\u6162\u6162\u9053\u6765\u3002\u8bdd\u8bf4\u8fd9\u5e74\u5934&#xff0c;\u5bb6\u91cc\u53a8\u623f\u7684\u71c3\u6c14\u7076\u3001\u70ed\u6c34\u5668\u3001\u751a\u81f3\u90a3\u53f0\u603b\u7231&#034;\u95f9\u813e\u6c14&#034;\u7684\u8001\u5f0f\u7164\u6c14\u7f50&#xff0c;\u90fd\u85cf\u7740\u4e00\u4e2a\u770b\u4e0d\u89c1\u6478\u4e0d\u7740\u7684\u9690\u60a3\u2014\u2014\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u3002\u4f60\u95fb\u4e0d\u5230\u3001\u770b\u4e0d\u89c1&#xff0c;\u7b49\u5b83\u6512\u591f\u4e86&#034;\u813e\u6c14&#034;&#xff0c;\u4e00\u4e2a\u706b\u661f\u5b50\u5c31\u80fd\u7ed9\u4f60\u4e0a\u6f14\u4e00\u51fa&#034;\u53a8\u623f\u53d8\u706b\u7bad\u53d1\u5c04\u573a&#034;\u7684\u60ca\u609a\u5927\u7247\u3002\u4e0d\u8fc7\u4eca\u5929\u54b1\u4eec\u8981\u5bf9\u4ed8\u7684&#xff0c;\u4e0d\u662f\u53a8\u623f\u91cc\u7684\u7164\u6c14&#xff0c;\u800c\u662f\u6253\u706b\u673a\u91cc\u90a3\u4f4d&#034;\u5c0f\u4e2a\u5b50\u5927\u813e\u6c14&#034;\u7684\u4e01\u70f7\u3002<\/p>\n<p>\u6240\u4ee5&#xff0c;\u4f5c\u4e3a\u4e00\u540d&#034;\u4e07\u7269\u7686\u53ef\u5355\u7247\u673a&#034;\u7684\u786c\u6838\u73a9\u5bb6&#xff0c;\u6211\u51b3\u5b9a\u7528\u4e00\u5757 STM32L4 \u5f00\u53d1\u677f\u3001\u4e00\u4e2a MQ-5 \u6c14\u4f53\u4f20\u611f\u5668&#xff0c;\u4eb2\u624b\u6253\u9020\u4e00\u53f0&#034;\u6253\u706b\u673a\u6c14\u4f53\u5b88\u62a4\u795e&#034;\u3002\u5b83\u4e0d\u7a7f\u62ab\u98ce&#xff0c;\u4e0d\u6234\u9762\u5177&#xff0c;\u4f46\u5b83\u80fd\u5728\u4e01\u70f7\u5077\u5077\u6e9c\u51fa\u6765\u7684\u65f6\u5019&#xff0c;\u7b2c\u4e00\u65f6\u95f4\u5728\u5c4f\u5e55\u4e0a\u5927\u558a&#xff1a;&#034;\u6709\u53ef\u71c3\u6c14\u4f53&#xff01;&#034;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260909093351-6aa127ff8ada2.png\" \/><\/p>\n<p>\u4eca\u5929\u8fd9\u7bc7\u535a\u5ba2&#xff0c;\u54b1\u4eec\u5c31\u4e00\u8d77\u62c6\u89e3\u8fd9\u4efd&#034;\u6253\u706b\u673a\u6c14\u4f53\u68c0\u6d4b\u5b9e\u9a8c&#034;\u4ee3\u7801&#xff0c;\u770b\u770b\u8fd9\u4f4d&#034;\u5b88\u62a4\u795e&#034;\u662f\u600e\u4e48\u70bc\u6210\u7684\u3002\u5168\u7a0b\u9ad8\u80fd&#xff0c;\u65e2\u6709\u786c\u6838\u6280\u672f&#xff0c;\u4e5f\u6709\u6c99\u96d5\u5410\u69fd&#xff0c;\u8fd8\u6709\u77e5\u8bc6\u70b9\u666e\u53ca\u548c\u907f\u5751\u6307\u5357&#xff0c;\u4fdd\u8bc1\u8ba9\u4f60\u7b11\u7740\u5b66\u4f1a\u3002<\/p>\n<p>\u00a0<\/p>\n<h3>&#x1f9ea; \u4e8c\u3001\u4e3b\u89d2\u767b\u573a&#xff1a;MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u5230\u5e95\u662f\u4e2a\u5565&#xff1f;<\/h3>\n<p>\u5148\u6765\u8ba4\u8bc6\u4e00\u4e0b\u4eca\u5929\u7684\u4e3b\u89d2\u2014\u2014MQ-5\u3002\u8fd9\u5bb6\u4f19\u957f\u5f97\u5176\u8c8c\u4e0d\u626c&#xff0c;\u4e00\u4e2a\u91d1\u5c5e\u5c0f\u5706\u5e3d&#xff0c;\u5e95\u4e0b\u516d\u6839\u5f15\u811a&#xff0c;\u6d3b\u50cf\u4e2a&#034;\u957f\u4e86\u817f\u7684\u8611\u83c7&#034;\u3002\u4f46\u4f60\u53ef\u522b\u5c0f\u770b\u5b83&#xff0c;\u5b83\u53ef\u662f\u6c14\u4f53\u68c0\u6d4b\u754c\u7684&#034;\u8001\u6c5f\u6e56&#034;\u3002.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260909093351-6aa127ffe8a5f.png\" \/><\/p>\n<h4>2.1 \u5de5\u4f5c\u539f\u7406&#xff1a;\u4e00\u573a&#034;\u7535\u963b\u53d8\u8138&#034;\u7684\u9b54\u672f<\/h4>\n<p>MQ-5 \u7684\u6838\u5fc3\u662f\u4e00\u4e2a\u4e8c\u6c27\u5316\u9521&#xff08;SnO2&#xff09;\u534a\u5bfc\u4f53\u6c14\u654f\u6750\u6599\u3002\u5728\u6d01\u51c0\u7a7a\u6c14\u4e2d&#xff0c;\u5b83\u7684\u7535\u963b\u9ad8\u9ad8\u5728\u4e0a&#xff0c;\u4e00\u526f&#034;\u751f\u4eba\u52ff\u8fd1&#034;\u7684\u50b2\u5a07\u6837&#xff1b;\u53ef\u4e00\u65e6\u63a5\u89e6\u5230\u53ef\u71c3\u6c14\u4f53&#xff08;\u6bd4\u5982\u7532\u70f7\u3001\u4e19\u70f7\u3001\u6db2\u5316\u6c14&#xff09;&#xff0c;\u5b83\u7684\u7535\u963b\u5c31\u4f1a\u77ac\u95f4&#034;\u53d8\u8138&#034;&#xff0c;\u8e6d\u8e6d\u5f80\u4e0b\u6389\u3002\u4f20\u611f\u5668\u6a21\u5757\u4e0a\u7684\u6bd4\u8f83\u5668\u7535\u8def\u6355\u6349\u5230\u8fd9\u4e2a\u53d8\u5316&#xff0c;\u8f93\u51fa\u4e00\u4e2a\u9ad8\u4f4e\u7535\u5e73\u2014\u20140 \u8868\u793a&#034;\u6709\u60c5\u51b5&#034;&#xff0c;1 \u8868\u793a&#034;\u4e00\u5207\u6b63\u5e38&#034;\u3002<\/p>\n<p>\u7b80\u5355\u8bf4&#xff0c;\u8fd9\u5c31\u662f\u4e00\u573a&#034;\u7535\u963b\u53d8\u8138&#034;\u7684\u9b54\u672f&#xff0c;\u800c\u6211\u4eec\u7684 STM32 \u5c31\u662f\u90a3\u4e2a\u770b\u7a7f\u9b54\u672f\u7684&#034;\u6bd2\u820c\u8bc4\u59d4&#034;\u3002<\/p>\n<h4>2.2 \u77e5\u8bc6\u70b9\u666e\u53ca&#xff1a;MQ-5 \u80fd\u6d4b\u5565&#xff1f;\u4e0d\u80fd\u6d4b\u5565&#xff1f;<\/h4>\n<ul>\n<li>\u64c5\u957f\u9886\u57df&#xff1a;\u6db2\u5316\u6c14\u3001\u5929\u7136\u6c14\u3001\u7532\u70f7\u3001\u4e19\u70f7\u3001\u4e01\u70f7&#xff08;\u6253\u706b\u673a\u6c14\u4f53&#xff09;\u7b49\u53ef\u71c3\u6c14\u4f53&#xff0c;\u7075\u654f\u5ea6\u76f8\u5f53\u4e0d\u9519\u3002<\/li>\n<li>\u4e0d\u64c5\u957f\u9886\u57df&#xff1a;\u9152\u7cbe\u3001\u70df\u96fe&#xff08;\u6ce8\u610f&#xff0c;\u5b83\u53eb&#034;\u6c14\u4f53\u4f20\u611f\u5668&#034;&#xff0c;\u4e0d\u662f&#034;\u70df\u611f\u62a5\u8b66\u5668&#034;&#xff09;&#xff0c;\u5bf9\u4e00\u6c27\u5316\u78b3\u7684\u54cd\u5e94\u4e5f\u6bd4\u8f83\u5f31\u3002\u4f60\u8981\u662f\u62ff\u5b83\u53bb\u6d4b\u4e8c\u624b\u70df&#xff0c;\u5b83\u53ea\u4f1a\u4e00\u8138\u832b\u7136\u3002<\/li>\n<li>\u8f93\u51fa\u65b9\u5f0f&#xff1a;\u6570\u5b57\u91cf&#xff08;DO&#xff0c;\u9ad8\u4f4e\u7535\u5e73&#xff09;\u548c\u6a21\u62df\u91cf&#xff08;AO&#xff0c;\u7535\u538b\u503c&#xff09;\u3002\u672c\u5b9e\u9a8c\u7528\u7684\u662f\u6570\u5b57\u91cf&#xff0c;\u7b80\u5355\u7c97\u66b4&#xff0c;\u9002\u5408\u5165\u95e8\u3002<\/li>\n<\/ul>\n<p>\u5c0f\u8d34\u58eb&#xff1a;MQ \u7cfb\u5217\u4f20\u611f\u5668\u4e0a\u7535\u540e\u9700\u8981\u9884\u70ed\u3002\u521a\u901a\u7535\u90a3\u4f1a\u513f&#xff0c;\u5b83\u7684\u8f93\u51fa\u4f1a&#034;\u62bd\u98ce&#034;\u4e00\u9635\u5b50&#xff0c;\u5c31\u50cf\u4eba\u521a\u7761\u9192\u8fd8\u6ca1\u6e05\u9192\u4e00\u6837\u3002\u6240\u4ee5\u4ee3\u7801\u91cc\u521d\u59cb\u5316\u540e\u522b\u6025\u7740\u4e0b\u7ed3\u8bba&#xff0c;\u7ed9\u5b83\u51e0\u5206\u949f&#034;\u9192\u9192\u795e&#034;\u2014\u2014\u51e0\u79d2\u53ea\u80fd\u505a\u5230\u521d\u6b65\u7a33\u5b9a&#xff0c;\u6c14\u654f\u6750\u6599\u5b8c\u5168\u7a33\u5b9a\u8981\u7b49\u6570\u5206\u949f\u3002<\/p>\n<h3>&#x1f4bb; \u4e09\u3001\u4ee3\u7801\u62c6\u89e3&#xff1a;\u4ece&#034;\u521d\u59cb\u5316\u4e09\u4ef6\u5957&#034;\u5230&#034;\u7075\u9b42\u4e3b\u5faa\u73af&#034;<\/h3>\n<p>\u597d\u4e86&#xff0c;\u95f2\u8bdd\u5c11\u53d9&#xff0c;\u54b1\u4eec\u76f4\u63a5\u4e0a\u4ee3\u7801\u3002\u8fd9\u4efd\u5b9e\u9a8c\u4ee3\u7801\u7ed3\u6784\u6e05\u6670&#xff0c;\u582a\u79f0&#034;\u6559\u79d1\u4e66\u7ea7&#034;\u7684 STM32 \u5916\u8bbe\u9a71\u52a8\u793a\u8303\u3002\u6211\u7ed9\u5b83\u8d77\u4e86\u4e2a\u5916\u53f7\u2014\u2014&#034;\u521d\u59cb\u5316\u4e09\u4ef6\u5957 &#043; \u7075\u9b42\u4e3b\u5faa\u73af&#034;\u3002<\/p>\n<h4>3.1 \u4e3b\u51fd\u6570&#xff1a;\u4e00\u5207\u4ece\u8fd9\u91cc\u5f00\u59cb<\/h4>\n<p>int main(void)<br \/>\n{<br \/>\n    HAL_Init();<br \/>\n    SystemClock_Config();<br \/>\n    LCD_Display_Init(); \/\/\u5c4f\u5e55\u521d\u59cb\u5316\u663e\u793a<br \/>\n    gpio_module_open(LEDS);<br \/>\n    uart_open(uart2, 115200);<br \/>\n    printf(&#034;\\\\r\\\\n        \u53ef\u71c3\u6c14\u4f53\u68c0\u6d4b\u5b9e\u9a8c        \\\\r\\\\n&#034;);<br \/>\n    printf(&#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;\\\\r\\\\n&#034;);<br \/>\n    printf(&#034;\u5f00\u59cb\u672c\u5b9e\u9a8c&#xff1a;\\\\r\\\\n\\\\r\\\\n&#034;);<br \/>\n    MQ5_Init(); \/\/\u521d\u59cb\u5316\u53ef\u71c3\u6c14\u4f53\u68c0\u6d4b\u5f15\u811a<br \/>\n    printf(&#034;** \u6c14\u4f53\u4f20\u611f\u5668\u521d\u59cb\u5316\\\\r\\\\n&#034;);<br \/>\n    printf(&#034;** \u8bfb\u53d6\u6c14\u4f53\u4f20\u611f\u5668\u6570\u636e\\\\r\\\\n&#034;);<br \/>\n    while(1)<br \/>\n    {<br \/>\n        MQ5_Handle(); \/\/\u68c0\u6d4b\u53ef\u71c3\u6c14\u4f53\u6a21\u5757\u72b6\u6001\u5e76\u663e\u793a<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u7684\u6d41\u7a0b&#xff0c;\u7528\u4e00\u53e5\u8bdd\u6982\u62ec\u5c31\u662f&#xff1a;\u5148\u628a\u81ea\u5df1\u6536\u62fe\u5229\u7d22&#xff0c;\u518d\u628a\u5916\u8bbe\u6328\u4e2a\u53eb\u9192&#xff0c;\u6700\u540e\u8fdb\u5165&#034;\u65e0\u9650\u5faa\u73af\u6253\u5de5&#034;\u6a21\u5f0f\u3002<\/p>\n<ul>\n<li>HAL_Init()&#xff1a;STM32 \u7684&#034;\u5f00\u673a\u81ea\u68c0&#034;&#xff0c;\u628a\u786c\u4ef6\u5e95\u5c42\u521d\u59cb\u5316\u597d&#xff0c;\u76f8\u5f53\u4e8e\u7ed9\u5355\u7247\u673a&#034;\u6d17\u8138\u5237\u7259&#034;\u3002<\/li>\n<li>SystemClock_Config()&#xff1a;\u914d\u7f6e\u7cfb\u7edf\u65f6\u949f\u3002\u8fd9\u53ef\u662f\u91cd\u4e2d\u4e4b\u91cd&#xff0c;\u65f6\u949f\u4e0d\u5bf9&#xff0c;\u6574\u4e2a\u7cfb\u7edf\u5c31\u50cf&#034;\u65f6\u5dee\u6ca1\u5012\u8fc7\u6765\u7684\u4eba&#034;&#xff0c;\u5e72\u5565\u90fd\u6162\u534a\u62cd\u3002<\/li>\n<li>LCD_Display_Init()&#xff1a;\u70b9\u4eae\u5c4f\u5e55&#xff0c;\u663e\u793a\u6b22\u8fce\u754c\u9762\u3002\u8fd9\u6b65\u7eaf\u7cb9\u662f&#034;\u4eea\u5f0f\u611f&#034;&#xff0c;\u544a\u8bc9\u7528\u6237&#034;\u6211\u9192\u4e86&#xff0c;\u51c6\u5907\u5e72\u6d3b&#034;\u3002<\/li>\n<li>uart_open(uart2, 115200)&#xff1a;\u6253\u5f00\u4e32\u53e3&#xff0c;\u6ce2\u7279\u7387 115200\u3002\u8fd9\u662f\u5355\u7247\u673a\u548c\u7535\u8111&#034;\u804a\u5929&#034;\u7684\u901a\u9053&#xff0c;\u8c03\u8bd5\u795e\u5668\u3002<\/li>\n<li>MQ5_Init()&#xff1a;\u521d\u59cb\u5316\u6c14\u4f53\u4f20\u611f\u5668\u5f15\u811a&#xff0c;\u8ba9 MQ-5 \u8fdb\u5165\u5de5\u4f5c\u72b6\u6001\u3002<\/li>\n<li>while(1)&#xff1a;\u7075\u9b42\u4e3b\u5faa\u73af\u3002\u5355\u7247\u673a\u4e0d\u50cf\u4eba&#xff0c;\u5b83\u4e0d\u4f1a&#034;\u4e0b\u73ed&#034;&#xff0c;\u53ea\u4f1a\u5728\u8fd9\u4e2a\u5faa\u73af\u91cc\u6c38\u4e0d\u505c\u6b47\u5730\u68c0\u6d4b\u3001\u663e\u793a\u3001\u8f93\u51fa\u3002<\/li>\n<\/ul>\n<h4>3.2 \u7075\u9b42\u4e3b\u5faa\u73af&#xff1a;MQ5_Handle \u7684&#034;\u6bcf\u79d2\u4e00\u95ee&#034;<\/h4>\n<p>void MQ5_Handle(void)<br \/>\n{<br \/>\n    uint8_t mq5_detect &#061; 0;<br \/>\n    static uint8_t mq2_detect_rev &#061; 3;<br \/>\n    static  uint32_t tickstart;<br \/>\n    if((HAL_GetTick() &#8211; tickstart) &gt;&#061; 1000)<br \/>\n    {<br \/>\n        tickstart &#061; HAL_GetTick();<br \/>\n        if(MQ5_Read_State() &#061;&#061; 0)<br \/>\n        {<br \/>\n            LCD_draw_bmp(96,120,48,gImage_yanwu);        \/\/\u6709\u53ef\u71c3\u6c14\u4f53\u56fe\u6807\u663e\u793a<br \/>\n            LCD_Fill(85,178,140,194,WHITE);              \/\/\u5237\u65b0\u663e\u793a<br \/>\n            Show_Str(85,178,BLUE,WHITE,&#034;\u6709\u53ef\u71c3\u6c14\u4f53&#034;,16,1);   \/\/\u663e\u793a\u6709\u53ef\u71c3\u6c14\u4f53<br \/>\n        }<br \/>\n        else if(MQ5_Read_State() &#061;&#061; 1)<br \/>\n        {<br \/>\n            LCD_draw_bmp(96,120,48,gImage_yanwu_hui);    \/\/\u65e0\u53ef\u71c3\u6c14\u4f53\u56fe\u6807\u663e\u793a<br \/>\n            LCD_Fill(85,178,140,194,WHITE);              \/\/\u5237\u65b0\u663e\u793a<br \/>\n            Show_Str(85,178,BLUE,WHITE,&#034;\u65e0\u53ef\u71c3\u6c14\u4f53&#034;,16,1);   \/\/\u663e\u793a\u65e0\u53ef\u71c3\u6c14\u4f53<br \/>\n        }<br \/>\n        mq5_detect &#061; MQ5_Read_State();<br \/>\n        if((!mq5_detect) !&#061; mq2_detect_rev)<br \/>\n        {<br \/>\n            if(!mq5_detect &#061;&#061; 1)<br \/>\n            {<br \/>\n                printf(&#034;combustible gas detect:\u662f\\\\r\\\\n&#034;);<br \/>\n            }<br \/>\n            else<br \/>\n            {<br \/>\n                printf(&#034;combustible gas detect:\u5426\\\\r\\\\n&#034;);<br \/>\n                mq2_detect_rev &#061; !mq5_detect;<br \/>\n            }<br \/>\n            led_toggle(LED1_PORT);<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u7684\u7cbe\u9ad3\u5728\u4e8e HAL_GetTick() \u8fd9\u4e2a&#034;\u65f6\u95f4\u7ba1\u5bb6&#034;\u3002\u5b83\u6bcf\u9694 1000 \u6beb\u79d2&#xff08;1 \u79d2&#xff09;\u624d\u6267\u884c\u4e00\u6b21\u68c0\u6d4b&#xff0c;\u65e2\u4fdd\u8bc1\u4e86\u5b9e\u65f6\u6027&#xff0c;\u53c8\u4e0d\u4f1a\u8ba9\u5355\u7247\u673a\u7d2f\u5f97&#034;\u6c14\u5598\u5401\u5401&#034;\u3002<\/p>\n<ul>\n<li>\u5c4f\u5e55\u663e\u793a&#xff1a;\u68c0\u6d4b\u5230\u53ef\u71c3\u6c14\u4f53&#xff08;\u8fd4\u56de 0&#xff09;&#xff0c;\u5c31\u663e\u793a\u4e00\u4e2a&#034;\u70df\u96fe\u56fe\u6807&#034;\u548c&#034;\u6709\u53ef\u71c3\u6c14\u4f53&#034;&#xff1b;\u6ca1\u68c0\u6d4b\u5230&#xff08;\u8fd4\u56de 1&#xff09;&#xff0c;\u5c31\u663e\u793a\u7070\u8272\u56fe\u6807\u548c&#034;\u65e0\u53ef\u71c3\u6c14\u4f53&#034;\u3002\u8fd9\u6ce2\u64cd\u4f5c&#xff0c;\u50cf\u6781\u4e86&#034;\u7ea2\u7eff\u706f&#034;\u2014\u2014\u7ea2\u706f\u505c&#xff0c;\u7eff\u706f\u884c\u3002<\/li>\n<li>\u4e32\u53e3\u8f93\u51fa&#xff1a;\u72b6\u6001\u53d8\u5316\u65f6&#xff0c;\u901a\u8fc7\u4e32\u53e3\u6253\u5370&#034;combustible gas detect:\u662f\/\u5426&#034;\u3002\u6ce8\u610f&#xff0c;\u8fd9\u91cc\u6709\u4e2a\u5c0f bug&#xff08;\u540e\u9762\u907f\u5751\u73af\u8282\u7ec6\u8bf4&#xff09;&#xff0c;\u4f46\u6574\u4f53\u903b\u8f91\u662f&#034;\u72b6\u6001\u53d8\u4e86\u624d\u6253\u5370&#034;&#xff0c;\u907f\u514d\u5237\u5c4f\u3002<\/li>\n<li>LED \u95ea\u70c1&#xff1a;\u72b6\u6001\u53d8\u5316\u65f6\u7ffb\u8f6c LED&#xff0c;\u7ed9\u4f60\u4e00\u4e2a&#034;\u89c6\u89c9&#043;\u542c\u89c9&#034;\u7684\u53cc\u91cd\u63d0\u9192&#xff08;\u5982\u679c\u63a5\u4e86\u8702\u9e23\u5668\u7684\u8bdd&#xff09;\u3002<\/li>\n<\/ul>\n<h3>\u23f1\ufe0f \u56db\u3001\u77e5\u8bc6\u70b9\u666e\u53ca&#xff1a;HAL_GetTick \u4e0e&#034;\u975e\u963b\u585e\u5ef6\u65f6&#034;\u7684\u827a\u672f<\/h3>\n<p>\u5f88\u591a\u521d\u5b66\u8005\u5199\u5ef6\u65f6&#xff0c;\u7b2c\u4e00\u53cd\u5e94\u5c31\u662f HAL_Delay(1000)\u3002\u4f46\u4f60\u77e5\u9053\u5417&#xff1f;HAL_Delay \u662f&#034;\u963b\u585e\u5f0f&#034;\u7684\u2014\u2014\u5b83\u4f1a\u8ba9\u5355\u7247\u673a\u50bb\u50bb\u5730\u7ad9\u5728\u539f\u5730\u6570\u6570&#xff0c;\u5565\u4e5f\u4e0d\u5e72\u3002\u8fd9\u5728\u7b80\u5355\u5b9e\u9a8c\u91cc\u6ca1\u95ee\u9898&#xff0c;\u53ef\u4e00\u65e6\u4f60\u7684\u7cfb\u7edf\u8981\u540c\u65f6\u5904\u7406\u591a\u4e2a\u4efb\u52a1&#xff08;\u6bd4\u5982\u4e00\u8fb9\u68c0\u6d4b\u6c14\u4f53&#xff0c;\u4e00\u8fb9\u5237\u5c4f\u5e55&#xff0c;\u4e00\u8fb9\u56de\u4e32\u53e3&#xff09;&#xff0c;\u963b\u585e\u5ef6\u65f6\u5c31\u4f1a\u8ba9\u7cfb\u7edf&#034;\u5361\u58f3&#034;\u3002<\/p>\n<p>\u800c HAL_GetTick() \u5c31\u4e0d\u4e00\u6837\u4e86\u3002\u5b83\u8fd4\u56de\u7684\u662f\u7cfb\u7edf\u4e0a\u7535\u4ee5\u6765\u7ecf\u8fc7\u7684\u6beb\u79d2\u6570&#xff0c;\u662f\u4e00\u4e2a&#034;\u53ea\u8bfb\u65f6\u949f&#034;\u3002\u6211\u4eec\u7528&#034;\u5f53\u524d\u65f6\u95f4 &#8211; \u4e0a\u6b21\u8bb0\u5f55\u65f6\u95f4 &gt;&#061; 1000&#034;\u6765\u5224\u65ad\u662f\u5426\u8fc7\u4e86 1 \u79d2&#xff0c;\u8fd9\u5c31\u662f\u7ecf\u5178\u7684\u975e\u963b\u585e\u5ef6\u65f6\u3002\u5355\u7247\u673a\u5728\u8fd9 1 \u79d2\u91cc\u8be5\u5e72\u561b\u5e72\u561b&#xff0c;\u65f6\u95f4\u5230\u4e86\u81ea\u7136&#034;\u56de\u5934\u770b\u4e00\u773c&#034;&#xff0c;\u582a\u79f0&#034;\u65f6\u95f4\u7ba1\u7406\u5927\u5e08&#034;\u3002\u987a\u5e26\u4e00\u63d0&#xff0c;HAL_GetTick \u57fa\u4e8e SysTick&#xff0c;\u6700\u5927\u8ba1\u6570\u5230\u7ea6 49 \u5929\u4f1a\u6ea2\u51fa&#xff0c;\u77ed\u5b9e\u9a8c\u65e0\u6240\u8c13&#xff0c;\u5927\u578b\u4ea7\u54c1\u8bbe\u8ba1\u65f6\u8981\u8003\u8651\u6ea2\u51fa\u5904\u7406\u3002<\/p>\n<p>\u77e5\u8bc6\u70b9&#xff1a;\u8fd9\u79cd&#034;\u8f6e\u8be2 &#043; \u65f6\u95f4\u6233&#034;\u7684\u6a21\u5f0f&#xff0c;\u662f\u5d4c\u5165\u5f0f\u5f00\u53d1\u4e2d\u975e\u5e38\u57fa\u7840\u4e5f\u975e\u5e38\u91cd\u8981\u7684\u601d\u60f3\u3002\u5b66\u4f1a\u4e86\u5b83&#xff0c;\u4f60\u5c31\u4ece&#034;\u53ea\u4f1a\u6b7b\u7b49&#034;\u7684\u840c\u65b0&#xff0c;\u8fdb\u5316\u6210\u4e86&#034;\u4f1a\u5077\u65f6\u95f4&#034;\u7684\u8001\u9e1f\u3002<\/p>\n<h3>\u26a0\ufe0f \u4e94\u3001\u907f\u5751\u6307\u5357&#xff1a;\u90a3\u4e9b\u5e74\u6211\u8e29\u8fc7\u7684&#034;\u6253\u706b\u673a\u6c14\u4f53\u5751&#034;<\/h3>\n<p>\u505a\u5b9e\u9a8c\u561b&#xff0c;\u54ea\u6709\u4e0d\u8e29\u5751\u7684&#xff1f;\u4e0b\u9762\u8fd9\u51e0\u6761&#xff0c;\u90fd\u662f\u6211&#xff08;\u548c\u65e0\u6570\u7f51\u53cb&#xff09;\u7528&#034;\u8840\u4e0e\u6cea&#034;\u6362\u6765\u7684\u7ecf\u9a8c&#xff0c;\u8bf7\u52a1\u5fc5\u6536\u597d\u3002<\/p>\n<h4>5.1 \u5751\u4e00&#xff1a;\u4f20\u611f\u5668\u9884\u70ed\u4e0d\u8db3&#xff0c;\u6570\u636e&#034;\u62bd\u98ce&#034;<\/h4>\n<p>MQ-5 \u4e0a\u7535\u540e\u9700\u8981\u9884\u70ed 2-5 \u5206\u949f&#xff0c;\u5185\u90e8\u52a0\u70ed\u4e1d\u624d\u80fd\u8ba9\u4e8c\u6c27\u5316\u9521\u6c14\u654f\u6750\u6599\u8fbe\u5230\u7a33\u5b9a\u5de5\u4f5c\u6e29\u5ea6\u3002\u4ec5\u4ec5\u7b49\u5f85\u51e0\u79d2\u53ea\u80fd\u8fbe\u5230\u7c97\u7565\u72b6\u6001&#xff0c;\u5982\u679c\u4e00\u4e0a\u7535\u5c31\u6025\u7740\u8bfb\u6570\u636e&#xff0c;\u4f1a\u53d1\u73b0\u8f93\u51fa\u503c\u5ffd\u9ad8\u5ffd\u4f4e&#xff0c;\u50cf\u4e2a&#034;\u9189\u6c49&#034;\u5728\u8df3\u821e\u3002\u89e3\u51b3\u529e\u6cd5&#xff1a;\u521d\u59cb\u5316\u540e\u52a0\u4e2a\u9884\u70ed\u7b49\u5f85&#xff0c;\u6216\u8005\u5e72\u8106\u5148\u8dd1\u4e2a&#034;\u9884\u70ed\u5012\u8ba1\u65f6&#034;\u518d\u5f00\u59cb\u68c0\u6d4b\u3002<\/p>\n<h4>5.2 \u5751\u4e8c&#xff1a;\u4ee3\u7801\u91cc\u7684&#034;\u5e7d\u7075 Bug&#034;<\/h4>\n<p>\u4ed4\u7ec6\u770b MQ5_Handle() \u91cc\u7684\u8fd9\u6bb5&#xff1a;<\/p>\n<p>if((!mq5_detect) !&#061; mq2_detect_rev)<br \/>\n{<br \/>\n    if(!mq5_detect &#061;&#061; 1)<br \/>\n    {<br \/>\n        printf(&#034;combustible gas detect:\u662f\\\\r\\\\n&#034;);<br \/>\n    }<br \/>\n    else<br \/>\n    {<br \/>\n        printf(&#034;combustible gas detect:\u5426\\\\r\\\\n&#034;);<br \/>\n        mq2_detect_rev &#061; !mq5_detect;<br \/>\n    }<br \/>\n    led_toggle(LED1_PORT);<br \/>\n}<\/p>\n<p>\u53d1\u73b0\u95ee\u9898\u4e86\u5417&#xff1f;mq2_detect_rev \u8fd9\u4e2a&#034;\u72b6\u6001\u8bb0\u5fc6\u53d8\u91cf&#034;\u53ea\u5728 else \u5206\u652f\u91cc\u88ab\u66f4\u65b0&#xff0c;\u800c if \u5206\u652f&#xff08;\u68c0\u6d4b\u5230\u6c14\u4f53&#xff09;\u91cc\u6ca1\u6709\u66f4\u65b0\u3002\u8fd9\u610f\u5473\u7740&#xff1a;\u5f53\u6c14\u4f53\u4ece&#034;\u65e0&#034;\u53d8&#034;\u6709&#034;\u65f6&#xff0c;\u72b6\u6001\u786e\u5b9e\u4f1a\u6253\u5370\u4e00\u6b21&#xff1b;\u4f46\u4ece&#034;\u6709&#034;\u53d8&#034;\u65e0&#034;\u65f6&#xff0c;mq2_detect_rev \u8fd8\u662f\u65e7\u503c&#xff0c;\u53ef\u80fd\u4e0d\u4f1a\u89e6\u53d1\u6253\u5370\u3002\u800c\u4e14\u53d8\u91cf\u540d\u8fd8\u53eb mq2_detect_rev&#xff0c;\u660e\u660e\u7528\u7684\u662f MQ-5&#xff0c;\u8fd9\u547d\u540d\u5f3a\u8feb\u75c7\u770b\u4e86\u5f97\u5f53\u573a\u53bb\u4e16\u3002<\/p>\n<p>\u6b63\u786e\u5199\u6cd5&#xff1a;\u628a mq2_detect_rev &#061; !mq5_detect; \u63d0\u5230 if \u5916\u9762&#xff0c;\u65e0\u8bba\u54ea\u4e2a\u5206\u652f\u90fd\u66f4\u65b0\u72b6\u6001\u3002\u81f3\u4e8e\u53d8\u91cf\u540d&#xff0c;\u5efa\u8bae\u6539\u6210 mq5_detect_rev&#xff0c;\u522b\u8ba9\u540e\u4eba&#034;\u8003\u53e4&#034;\u3002<\/p>\n<h4>5.3 \u5751\u4e09&#xff1a;\u6570\u5b57\u91cf vs \u6a21\u62df\u91cf&#xff0c;\u522b\u9009\u9519&#034;\u8d5b\u9053&#034;<\/h4>\n<p>MQ-5 \u6a21\u5757\u901a\u5e38\u6709\u4e24\u4e2a\u8f93\u51fa&#xff1a;DO&#xff08;\u6570\u5b57\u91cf&#xff09;\u548c AO&#xff08;\u6a21\u62df\u91cf&#xff09;\u3002\u672c\u5b9e\u9a8c\u7528\u7684\u662f DO&#xff0c;\u53ea\u80fd\u544a\u8bc9\u4f60&#034;\u6709\/\u6ca1\u6709&#034;&#xff0c;\u662f\u4e2a&#034;\u76f4\u7537&#034;&#xff1b;AO \u8f93\u51fa\u7684\u662f\u7535\u538b\u503c&#xff0c;\u80fd\u544a\u8bc9\u4f60&#034;\u6d53\u5ea6\u5927\u6982\u591a\u5c11&#034;&#xff0c;\u662f\u4e2a&#034;\u6696\u7537&#034;\u3002\u6ce8\u610f&#xff0c;DO \u7684\u62a5\u8b66\u9608\u503c\u7531\u677f\u8f7d LM393 \u6bd4\u8f83\u5668\u914d\u5957\u7684\u7535\u4f4d\u5668\u51b3\u5b9a&#xff0c;\u65cb\u8f6c\u7535\u4f4d\u5668\u5c31\u80fd\u8c03\u8282\u7075\u654f\u5ea6\u2014\u2014\u8c03\u592a\u7075\u654f&#xff0c;\u8f7b\u5fae\u9152\u7cbe\u5c31\u8bef\u62a5&#xff1b;\u8c03\u592a\u8fdf\u949d&#xff0c;\u771f\u6cc4\u6f0f\u4e86\u4e5f\u4e0d\u62a5\u8b66\u3002\u5982\u679c\u4f60\u8981\u505a\u6d53\u5ea6\u76d1\u6d4b&#xff08;\u6bd4\u5982\u663e\u793a PPM \u503c&#xff09;&#xff0c;\u5fc5\u987b\u7528 ADC \u8bfb AO&#xff0c;\u8fd8\u5f97\u505a\u6d53\u5ea6\u6807\u5b9a\u3002\u522b\u62ff DO \u5f53 AO \u7528&#xff0c;\u90a3\u5c31\u50cf\u62ff\u4f53\u6e29\u8ba1\u6d4b\u8840\u538b\u2014\u2014\u4e0d\u662f\u4e0d\u884c&#xff0c;\u662f\u6839\u672c\u4e0d\u5bf9\u8def\u3002<\/p>\n<h4>5.4 \u5751\u56db&#xff1a;\u4f9b\u7535\u4e0d\u8db3&#xff0c;\u4f20\u611f\u5668&#034;\u997f\u809a\u5b50&#034;<\/h4>\n<p>MQ-5 \u7684\u52a0\u70ed\u4e1d\u662f\u4e2a&#034;\u7535\u8001\u864e&#034;&#xff0c;\u6a21\u5757\u6574\u4f53\u5de5\u4f5c\u7535\u6d41\u5927\u7ea6 80-120mA\u3002\u5982\u679c\u4f60\u7528\u5f00\u53d1\u677f\u7684 3.3V \u5f15\u811a\u76f4\u63a5\u7ed9\u5b83\u4f9b\u7535&#xff0c;\u5f88\u53ef\u80fd&#034;\u5582\u4e0d\u9971&#034;&#xff0c;\u5bfc\u81f4\u8bfb\u6570\u6f02\u79fb\u751a\u81f3\u4e0d\u5de5\u4f5c\u3002\u5efa\u8bae\u7528 5V \u4f9b\u7535&#xff0c;\u5e76\u4e14\u5355\u72ec\u7ed9\u4f20\u611f\u5668\u6a21\u5757\u4f9b\u7535&#xff0c;\u522b\u548c\u5355\u7247\u673a\u62a2&#034;\u53e3\u7cae&#034;\u3002<\/p>\n<h4>5.5 \u5751\u4e94&#xff1a;\u6d4b\u8bd5\u6c14\u4f53\u522b\u4e71\u55b7<\/h4>\n<p>\u6d4b\u8bd5\u65f6\u7528\u6253\u706b\u673a\u6c14\u4f53&#xff08;\u4e01\u70f7&#xff09;\u5bf9\u7740\u4f20\u611f\u5668\u55b7\u4e00\u4e0b\u5c31\u884c&#xff0c;\u5343\u4e07\u522b\u7528\u660e\u706b\u53bb&#034;\u70e4&#034;\u5b83\u3002\u6253\u706b\u673a\u91cc\u662f\u9ad8\u538b\u6db2\u6001\u4e01\u70f7&#xff0c;\u91ca\u653e\u51fa\u6765\u4f1a\u8fc5\u901f\u6c7d\u5316&#xff0c;\u6240\u4ee5\u4e0d\u8981\u8fde\u7eed\u5927\u91cf\u91ca\u653e&#xff0c;\u4e0d\u8981\u5728\u5bc6\u95ed\u5c0f\u7a7a\u95f4\u505a\u5b9e\u9a8c&#xff0c;\u8fdc\u79bb\u4e00\u5207\u706b\u79cd\u3002\u6bd5\u7adf\u54b1\u4eec\u662f\u641e\u5b9e\u9a8c&#xff0c;\u4e0d\u662f\u641e&#034;\u7206\u7834&#034;\u3002\u5b89\u5168\u7b2c\u4e00&#xff0c;\u5e7d\u9ed8\u7b2c\u4e8c\u3002<\/p>\n<h4>\u00a0<\/h4>\n<h3>&#x1f3af; \u516d\u3001\u603b\u7ed3&#xff1a;\u4ece&#034;\u6253\u706b\u673a\u6c14\u4f53\u5b88\u62a4\u795e&#034;\u5230&#034;\u5d4c\u5165\u5f0f\u8001\u9e1f&#034;<\/h3>\n<p>\u26a0\ufe0f \u91cd\u8981\u8bf4\u660e&#xff1a;\u672c\u9879\u76ee\u4ec5\u4e3a STM32 \u7269\u8054\u7f51\u8bfe\u7a0b\u6f14\u793a\u5b9e\u9a8c\u3002MQ-5 \u5c5e\u4e8e\u91d1\u5c5e\u6c27\u5316\u7269&#xff08;MOS&#xff09;\u6c14\u654f\u4f20\u611f\u5668&#xff0c;\u5b58\u5728\u6c14\u4f53\u4ea4\u53c9\u5e72\u6270&#xff08;\u9152\u7cbe\u3001\u9999\u6c34\u7b49\u4f1a\u8bef\u89e6\u53d1&#xff09;&#xff0c;\u4e14\u672c\u5b9e\u9a8c\u88c5\u7f6e\u65e0\u6d88\u9632\u8ba4\u8bc1&#xff0c;\u4e0d\u53ef\u66ff\u4ee3\u6b63\u89c4\u5bb6\u7528\u62a5\u8b66\u5668&#xff0c;\u4e0d\u80fd\u7528\u4e8e\u5bb6\u5ead\u71c3\u6c14\u5b89\u5168\u9632\u62a4\u3002<\/p>\n<p>\u597d\u4e86&#xff0c;\u8fd9\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u5192\u9669\u5c31\u5230\u8fd9\u91cc\u3002\u6211\u4eec\u4ece\u4e00\u4e2a&#034;\u770b\u4e0d\u89c1\u7684\u654c\u4eba&#034;\u8bf4\u8d77&#xff0c;\u8ba4\u8bc6\u4e86 MQ-5 \u8fd9\u4f4d&#034;\u7535\u963b\u53d8\u8138&#034;\u7684\u9b54\u672f\u5e08&#xff0c;\u62c6\u89e3\u4e86 STM32 \u7684\u521d\u59cb\u5316\u6d41\u7a0b\u548c\u7075\u9b42\u4e3b\u5faa\u73af&#xff0c;\u8fd8\u5b66\u4f1a\u4e86\u975e\u963b\u585e\u5ef6\u65f6\u7684\u827a\u672f&#xff0c;\u6700\u540e\u6536\u83b7\u4e86\u4e00\u7ba9\u7b50\u907f\u5751\u7ecf\u9a8c\u3002<\/p>\n<p>\u8bf4\u5b9e\u8bdd&#xff0c;\u8fd9\u4e2a\u5b9e\u9a8c\u7684\u4ee3\u7801\u5e76\u4e0d\u590d\u6742&#xff0c;\u4f46\u5b83\u80cc\u540e\u8574\u542b\u7684\u601d\u60f3\u2014\u2014\u521d\u59cb\u5316\u5916\u8bbe\u3001\u8f6e\u8be2\u72b6\u6001\u3001\u975e\u963b\u585e\u5ef6\u65f6\u3001\u72b6\u6001\u53d8\u5316\u68c0\u6d4b\u2014\u2014\u662f\u5d4c\u5165\u5f0f\u5f00\u53d1\u7684&#034;\u57fa\u672c\u529f&#034;\u3002\u628a\u8fd9\u5957\u529f\u592b\u7ec3\u624e\u5b9e\u4e86&#xff0c;\u4ee5\u540e\u65e0\u8bba\u662f\u505a\u6e29\u6e7f\u5ea6\u8ba1\u3001\u70df\u96fe\u62a5\u8b66\u5668&#xff0c;\u8fd8\u662f\u667a\u80fd\u5bb6\u5c45\u7f51\u5173&#xff0c;\u4f60\u90fd\u80fd\u4e3e\u4e00\u53cd\u4e09&#xff0c;\u6e38\u5203\u6709\u4f59\u3002<\/p>\n<p>\u6700\u540e\u9001\u5927\u5bb6\u4e00\u53e5\u8bdd&#xff1a;\u4ee3\u7801\u53ef\u4ee5\u6c99\u96d5&#xff0c;\u4f46\u6001\u5ea6\u5fc5\u987b\u786c\u6838\u3002\u613f\u4f60\u7684\u6bcf\u4e00\u6b21\u5b9e\u9a8c&#xff0c;\u90fd\u80fd\u50cf MQ-5 \u68c0\u6d4b\u5230\u6253\u706b\u673a\u6c14\u4f53\u4e00\u6837\u2014\u2014\u53cd\u5e94\u7075\u654f&#xff0c;\u4ece\u4e0d\u8bef\u62a5\u3002\u54b1\u4eec\u4e0b\u671f\u518d\u89c1&#xff01;<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x1f525; \u4e00\u3001\u4e3a\u4ec0\u4e48\u6211\u8981\u8ddf\\&#8221;\u770b\u4e0d\u89c1\u7684\u654c\u4eba\\&#8221;\u8f83\u52b2&#xff1f;\u5404\u4f4d\u770b\u5b98&#xff0c;\u4e14\u542c\u6211\u6162\u6162\u9053\u6765\u3002\u8bdd\u8bf4\u8fd9\u5e74\u5934&#xff0c;\u5bb6\u91cc\u53a8\u623f\u7684\u71c3\u6c14\u7076\u3001\u70ed\u6c34\u5668\u3001\u751a\u81f3\u90a3\u53f0\u603b\u7231\\&#8221;\u95f9\u813e\u6c14\\&#8221;\u7684\u8001\u5f0f\u7164\u6c14\u7f50&#xff0c;\u90fd\u85cf\u7740\u4e00\u4e2a\u770b\u4e0d\u89c1\u6478\u4e0d\u7740\u7684\u9690\u60a3\u2014\u2014\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u3002\u4f60\u95fb\u4e0d\u5230\u3001\u770b\u4e0d\u89c1&#xff0c;\u7b49\u5b83\u6512\u591f\u4e86\\&#8221;\u813e\u6c14\\&#8221;&#xff0c;\u4e00\u4e2a\u706b\u661f\u5b50\u5c31\u80fd\u7ed9\u4f60\u4e0a\u6f14\u4e00\u51fa\\&#8221;\u53a8\u623f\u53d8\u706b\u7bad\u53d1\u5c04\u573a\\&#8221;\u7684\u60ca\u609a\u5927\u7247\u3002\u4e0d\u8fc7\u4eca\u5929\u54b1\u4eec\u8981\u5bf9\u4ed8\u7684&#xff0c;\u4e0d\u662f\u53a8\u623f\u91cc\u7684\u7164\u6c14&#xff0c;\u800c\u662f\u6253\u706b\u673a\u91cc\u90a3\u4f4d\\&#8221;\u5c0f\u4e2a\u5b50\u5927\u813e<\/p>\n","protected":false},"author":2,"featured_media":102917,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[217,270,269],"topic":[],"class_list":["post-102919","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-stm32","tag-270","tag-269"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5f53 STM32 \u9047\u4e0a\u201c\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u201c\uff1a\u4e00\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u786c\u6838\u53c8\u6c99\u96d5\u7684\u5192\u9669 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/102919.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5f53 STM32 \u9047\u4e0a\u201c\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u201c\uff1a\u4e00\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u786c\u6838\u53c8\u6c99\u96d5\u7684\u5192\u9669 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"&#x1f525; \u4e00\u3001\u4e3a\u4ec0\u4e48\u6211\u8981\u8ddf&quot;\u770b\u4e0d\u89c1\u7684\u654c\u4eba&quot;\u8f83\u52b2&#xff1f;\u5404\u4f4d\u770b\u5b98&#xff0c;\u4e14\u542c\u6211\u6162\u6162\u9053\u6765\u3002\u8bdd\u8bf4\u8fd9\u5e74\u5934&#xff0c;\u5bb6\u91cc\u53a8\u623f\u7684\u71c3\u6c14\u7076\u3001\u70ed\u6c34\u5668\u3001\u751a\u81f3\u90a3\u53f0\u603b\u7231&quot;\u95f9\u813e\u6c14&quot;\u7684\u8001\u5f0f\u7164\u6c14\u7f50&#xff0c;\u90fd\u85cf\u7740\u4e00\u4e2a\u770b\u4e0d\u89c1\u6478\u4e0d\u7740\u7684\u9690\u60a3\u2014\u2014\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u3002\u4f60\u95fb\u4e0d\u5230\u3001\u770b\u4e0d\u89c1&#xff0c;\u7b49\u5b83\u6512\u591f\u4e86&quot;\u813e\u6c14&quot;&#xff0c;\u4e00\u4e2a\u706b\u661f\u5b50\u5c31\u80fd\u7ed9\u4f60\u4e0a\u6f14\u4e00\u51fa&quot;\u53a8\u623f\u53d8\u706b\u7bad\u53d1\u5c04\u573a&quot;\u7684\u60ca\u609a\u5927\u7247\u3002\u4e0d\u8fc7\u4eca\u5929\u54b1\u4eec\u8981\u5bf9\u4ed8\u7684&#xff0c;\u4e0d\u662f\u53a8\u623f\u91cc\u7684\u7164\u6c14&#xff0c;\u800c\u662f\u6253\u706b\u673a\u91cc\u90a3\u4f4d&quot;\u5c0f\u4e2a\u5b50\u5927\u813e\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/102919.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-09T09:33:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260909093351-6aa127ff8ada2.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/102919.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/102919.html\",\"name\":\"\u5f53 STM32 \u9047\u4e0a\u201c\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u201c\uff1a\u4e00\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u786c\u6838\u53c8\u6c99\u96d5\u7684\u5192\u9669 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-09T09:33:53+00:00\",\"dateModified\":\"2026-09-09T09:33:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/102919.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/102919.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/102919.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5f53 STM32 \u9047\u4e0a\u201c\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u201c\uff1a\u4e00\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u786c\u6838\u53c8\u6c99\u96d5\u7684\u5192\u9669\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5f53 STM32 \u9047\u4e0a\u201c\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u201c\uff1a\u4e00\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u786c\u6838\u53c8\u6c99\u96d5\u7684\u5192\u9669 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/102919.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5f53 STM32 \u9047\u4e0a\u201c\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u201c\uff1a\u4e00\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u786c\u6838\u53c8\u6c99\u96d5\u7684\u5192\u9669 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"&#x1f525; \u4e00\u3001\u4e3a\u4ec0\u4e48\u6211\u8981\u8ddf\"\u770b\u4e0d\u89c1\u7684\u654c\u4eba\"\u8f83\u52b2&#xff1f;\u5404\u4f4d\u770b\u5b98&#xff0c;\u4e14\u542c\u6211\u6162\u6162\u9053\u6765\u3002\u8bdd\u8bf4\u8fd9\u5e74\u5934&#xff0c;\u5bb6\u91cc\u53a8\u623f\u7684\u71c3\u6c14\u7076\u3001\u70ed\u6c34\u5668\u3001\u751a\u81f3\u90a3\u53f0\u603b\u7231\"\u95f9\u813e\u6c14\"\u7684\u8001\u5f0f\u7164\u6c14\u7f50&#xff0c;\u90fd\u85cf\u7740\u4e00\u4e2a\u770b\u4e0d\u89c1\u6478\u4e0d\u7740\u7684\u9690\u60a3\u2014\u2014\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u3002\u4f60\u95fb\u4e0d\u5230\u3001\u770b\u4e0d\u89c1&#xff0c;\u7b49\u5b83\u6512\u591f\u4e86\"\u813e\u6c14\"&#xff0c;\u4e00\u4e2a\u706b\u661f\u5b50\u5c31\u80fd\u7ed9\u4f60\u4e0a\u6f14\u4e00\u51fa\"\u53a8\u623f\u53d8\u706b\u7bad\u53d1\u5c04\u573a\"\u7684\u60ca\u609a\u5927\u7247\u3002\u4e0d\u8fc7\u4eca\u5929\u54b1\u4eec\u8981\u5bf9\u4ed8\u7684&#xff0c;\u4e0d\u662f\u53a8\u623f\u91cc\u7684\u7164\u6c14&#xff0c;\u800c\u662f\u6253\u706b\u673a\u91cc\u90a3\u4f4d\"\u5c0f\u4e2a\u5b50\u5927\u813e","og_url":"https:\/\/www.wsisp.com\/helps\/102919.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-09T09:33:53+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260909093351-6aa127ff8ada2.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/102919.html","url":"https:\/\/www.wsisp.com\/helps\/102919.html","name":"\u5f53 STM32 \u9047\u4e0a\u201c\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u201c\uff1a\u4e00\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u786c\u6838\u53c8\u6c99\u96d5\u7684\u5192\u9669 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-09T09:33:53+00:00","dateModified":"2026-09-09T09:33:53+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/102919.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/102919.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/102919.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5f53 STM32 \u9047\u4e0a\u201c\u53ef\u71c3\u6c14\u4f53\u6cc4\u6f0f\u201c\uff1a\u4e00\u573a\u5173\u4e8e MQ-5 \u6c14\u4f53\u4f20\u611f\u5668\u7684\u786c\u6838\u53c8\u6c99\u96d5\u7684\u5192\u9669"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/102919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=102919"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/102919\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/102917"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=102919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=102919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=102919"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=102919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}