{"id":43066,"date":"2025-06-11T08:54:35","date_gmt":"2025-06-11T00:54:35","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/43066.html"},"modified":"2025-06-11T08:54:35","modified_gmt":"2025-06-11T00:54:35","slug":"dht11%e6%b8%a9%e6%b9%bf%e5%ba%a6%e4%bc%a0%e6%84%9f%e5%99%a8%e8%af%a6%e8%a7%a3%ef%bc%88stm32%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/43066.html","title":{"rendered":"DHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u8be6\u89e3\uff08STM32\uff09"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%C2%A0%E4%B8%80%E3%80%81%E4%BB%8B%E7%BB%8D-toc\" style=\"margin-left:0px\">\u00a0\u4e00\u3001\u4ecb\u7ecd<\/p>\n<p id=\"%C2%A0%E4%BA%8C%E3%80%81%E4%BC%A0%E6%84%9F%E5%99%A8%E5%8E%9F%E7%90%86-toc\" style=\"margin-left:0px\">\u00a0\u4e8c\u3001\u4f20\u611f\u5668\u539f\u7406<\/p>\n<p id=\"1.%E5%8E%9F%E7%90%86%E5%9B%BE-toc\" style=\"margin-left:40px\">1.\u539f\u7406\u56fe<\/p>\n<p id=\"2.%E5%B7%A5%E4%BD%9C%E6%97%B6%E5%BA%8F-toc\" style=\"margin-left:40px\">2.\u5de5\u4f5c\u65f6\u5e8f<\/p>\n<p id=\"3.%E8%B5%B7%E5%A7%8B%E4%BF%A1%E5%8F%B7%E4%B8%8E%E5%93%8D%E5%BA%94%E4%BF%A1%E5%8F%B7-toc\" style=\"margin-left:40px\">3.\u8d77\u59cb\u4fe1\u53f7\u4e0e\u54cd\u5e94\u4fe1\u53f7<\/p>\n<p id=\"%C2%A04.%E8%AF%BB%E6%95%B0%E6%8D%AE%E6%97%B6%E5%BA%8F-toc\" style=\"margin-left:40px\">4.\u8bfb\u6570\u636e\u65f6\u5e8f<\/p>\n<p id=\"%C2%A05.DHT11%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F-toc\" style=\"margin-left:40px\">\u00a05.DHT11\u6570\u636e\u683c\u5f0f<\/p>\n<p id=\"%E4%B8%89%E3%80%81%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1-toc\" style=\"margin-left:0px\">\u4e09\u3001\u7a0b\u5e8f\u8bbe\u8ba1<\/p>\n<p id=\"%C2%A0main.c%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:40px\">\u00a0main.c\u6587\u4ef6<\/p>\n<p id=\"%C2%A0dht11.h%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:40px\">\u00a0dht11.h\u6587\u4ef6<\/p>\n<p id=\"dht11.c%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:40px\">\u00a0dht11.c\u6587\u4ef6<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E5%AE%9E%E9%AA%8C%E6%95%88%E6%9E%9C%E5%B1%95%E7%A4%BA-toc\" style=\"margin-left:0px\">\u56db\u3001\u5b9e\u9a8c\u6548\u679c\u5c55\u793a<\/p>\n<p id=\"%C2%A0%E4%BA%94%E3%80%81%E8%B5%84%E6%96%99%E8%8E%B7%E5%8F%96-toc\" style=\"margin-left:0px\">\u00a0\u4e94\u3001\u8d44\u6599\u83b7\u53d6<\/p>\n<p id=\"%C2%A0%C2%A0%E9%A1%B9%E7%9B%AE%E5%88%86%E4%BA%AB-toc\" style=\"margin-left:40px\">\u00a0\u00a0\u9879\u76ee\u5206\u4eab<\/p>\n<h2 id=\"%C2%A0%E4%B8%80%E3%80%81%E4%BB%8B%E7%BB%8D\">\u00a0\u4e00\u3001\u4ecb\u7ecd<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color:#2f2f2f\">DHT11\u662f\u4e00\u6b3e\u542b\u6709\u5df2\u6821\u51c6\u6570\u5b57\u4fe1\u53f7\u8f93\u51fa\u7684\u6e29\u6e7f\u5ea6\u590d\u5408\u4f20\u611f\u5668&#xff0c;\u91c7\u7528\u4e86\u81ea\u4e3b\u7814\u53d1\u7684\u96c6\u6210\u5f0f\u6570\u5b57\u6e29\u6e7f\u5ea6\u5143\u4ef6&#xff0c;\u5e94\u7528\u4e13\u7528\u7684\u6570\u5b57\u6a21\u5757\u91c7\u96c6\u6280\u672f\u548c\u6e29\u6e7f\u5ea6\u4f20\u611f\u6280\u672f&#xff0c;\u786e\u4fdd\u4ea7\u54c1\u5177\u6709\u6781\u9ad8\u7684\u53ef\u9760\u6027\u4e0e\u5353\u8d8a\u7684\u957f\u671f\u7a33\u5b9a\u6027\u3002DHT11<\/span><span style=\"color:#2f2f2f\">\u4f20\u611f\u5668\u5185\u5305\u542b\u4e00\u4e2a<\/span><span style=\"color:#ff0000\">\u6e29\u6e7f\u5ea6\u6d4b\u91cf\u5143\u4ef6<\/span><span style=\"color:#2f2f2f\">\u548c\u4e00\u4e2a<\/span><span style=\"color:#ff0000\">\u9ad8\u6027\u80fd<\/span><span style=\"color:#ff0000\">MCU<\/span><span style=\"color:#2f2f2f\">\u3002<\/span><\/p>\n<p style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"362\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005426-6848d3c296ce8.jpg\" width=\"366\" \/><\/p>\n<p>\u00a0\u4ee5\u4e0b\u662fDHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u7684\u53c2\u6570&#xff1a;<\/p>\n<table cellspacing=\"0\" style=\"width:390pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f1f1f1;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u4f9b\u7535\u7535\u538b\u00a0<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">DC&#xff1a;3.3-5.5V<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u5de5\u4f5c\u8303\u56f4<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">(<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u6e29\u5ea6<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">)<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">-20~&#043;60\u2103<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u91cf\u7a0b\u8303\u56f4<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">(<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u6e7f\u5ea6<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">)<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">5~95%RH<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u6e29\u5ea6\u7cbe\u5ea6<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">\u00b12\u2103<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u6e7f\u5ea6\u7cbe\u5ea6<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">\u00b15%RH<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u91cd\u590d\u6027<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">\u6e29\u5ea6&#xff1a;<\/span><span style=\"color:#333333\">\u00b11\u2103\u00a0<\/span><span style=\"color:#333333\">&#xff1b;\u6e7f\u5ea6&#xff1a;<\/span><span style=\"color:#333333\">\u00b11%RH<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u8fdf\u6ede<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">(<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u6e29\u5ea6<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">)<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">\u00b10.3\u2103<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u8fdf\u6ede<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">(<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u6e7f\u5ea6<\/span><\/span><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">)<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">\u00b10.3%RH<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u54d4\u54e9\u54d4\u54e9\u89c6\u9891\u94fe\u63a5&#xff1a;<\/p>\n<p>https:\/\/www.bilibili.com\/video\/BV182421Z7by\/?share_source&#061;copy_web&#038;vd_source&#061;097fdeaf6b6ecfed8a9ff7119c32faf2<\/p>\n<p><span style=\"color:#fe2c24\">&#xff08;\u8d44\u6599\u5206\u4eab\u89c1\u6587\u672b&#xff09;\u00a0<\/span><\/p>\n<h2 id=\"%C2%A0%E4%BA%8C%E3%80%81%E4%BC%A0%E6%84%9F%E5%99%A8%E5%8E%9F%E7%90%86\">\u00a0\u4e8c\u3001\u4f20\u611f\u5668\u539f\u7406<\/h2>\n<h3 id=\"1.%E5%8E%9F%E7%90%86%E5%9B%BE\">1.\u539f\u7406\u56fe<\/h3>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005427-6848d3c31402c.png\" \/>\u00a0\u00a0<span style=\"color:#000000\">\u5355\u603b\u7ebf\u4e0a\u5fc5\u987b\u6709\u4e00\u4e2a\u4e0a\u62c9\u7535\u963b&#xff08;<\/span><span style=\"color:#231916\">R1<\/span><span style=\"color:#000000\">&#xff09;\u4ee5\u5b9e\u73b0\u5355\u603b\u7ebf<\/span><span style=\"color:#ff0000\">\u95f2\u7f6e<\/span><span style=\"color:#000000\">\u65f6&#xff0c;\u5176\u5904\u4e8e<\/span><span style=\"color:#ff0000\">\u9ad8\u7535\u5e73\u72b6\u6001<\/span><\/p>\n<h3 id=\"2.%E5%B7%A5%E4%BD%9C%E6%97%B6%E5%BA%8F\">2.\u5de5\u4f5c\u65f6\u5e8f<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"117\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005430-6848d3c64464f.png\" width=\"1200\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"393\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005430-6848d3c65a169.png\" width=\"1200\" \/><\/p>\n<table border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#3e72b9;border-color:#ffffff;text-align:center;vertical-align:top;width:101pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ffffff\">\u7b26\u53f7<\/span><\/p>\n<\/td>\n<td style=\"background-color:#3e72b9;border-color:#ffffff;text-align:center;vertical-align:top;width:220pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ffffff\">\u53c2\u6570<\/span><\/p>\n<\/td>\n<td style=\"background-color:#3e72b9;border-color:#ffffff;text-align:center;vertical-align:top;width:119pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ffffff\">\u6700\u5c0f<\/span><\/p>\n<\/td>\n<td style=\"background-color:#3e72b9;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ffffff\">\u5178\u578b<\/span><\/p>\n<\/td>\n<td style=\"background-color:#3e72b9;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ffffff\">\u6700\u5927<\/span><\/p>\n<\/td>\n<td style=\"background-color:#3e72b9;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ffffff\">\u5355\u4f4d<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:101pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">Tbe<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:220pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">\u4e3b\u673a\u8d77\u59cb\u4fe1\u53f7\u62c9\u4f4e\u65f6\u95f4<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:119pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">18<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ff0000\">20<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">30<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">ms<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:101pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">Tgo<\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:220pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">\u4e3b\u673a\u91ca\u653e\u5355\u603b\u7ebf\u65f6\u95f4<\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:119pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">10<\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ff0000\">13<\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">35<\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">us<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:101pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">Trel<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:220pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">\u54cd\u5e94\u4f4e\u7535\u5e73\u65f6\u95f4<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:119pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">78<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ff0000\">83<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">88<\/span><\/p>\n<\/td>\n<td style=\"background-color:#ced5e6;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">us<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:101pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">Treh<\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:220pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">\u54cd\u5e94\u9ad8\u7535\u5e73\u65f6\u95f4 <\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:119pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">80<\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#ff0000\">87<\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">92<\/span><\/p>\n<\/td>\n<td style=\"background-color:#e8ebf3;border-color:#ffffff;text-align:center;vertical-align:top;width:147pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#2f2f2f\">us<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"3.%E8%B5%B7%E5%A7%8B%E4%BF%A1%E5%8F%B7%E4%B8%8E%E5%93%8D%E5%BA%94%E4%BF%A1%E5%8F%B7\">3.\u8d77\u59cb\u4fe1\u53f7\u4e0e\u54cd\u5e94\u4fe1\u53f7<\/h3>\n<h3 id=\"%E2%80%8B%E7%BC%96%E8%BE%91\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"427\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005430-6848d3c69fc7b.png\" width=\"1200\" \/><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"206\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005430-6848d3c6d201d.png\" width=\"1200\" \/><\/p>\n<h3 id=\"%C2%A04.%E8%AF%BB%E6%95%B0%E6%8D%AE%E6%97%B6%E5%BA%8F\">4.\u8bfb\u6570\u636e\u65f6\u5e8f<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"413\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005430-6848d3c6f34b8.png\" width=\"1200\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"97\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005431-6848d3c7511a5.png\" width=\"1200\" \/><\/p>\n<h3 id=\"%C2%A05.DHT11%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F\">\u00a05.DHT11\u6570\u636e\u683c\u5f0f<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"208\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005431-6848d3c76493a.png\" width=\"1200\" \/><\/p>\n<p>\u00a0<span style=\"color:#2f2f2f\">34H &#043; 01H &#043; 18H &#043; 8CH &#061; D9H<\/span><\/p>\n<p><span style=\"color:#2f2f2f\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6e7f\u5ea6\u9ad88\u4f4d&#xff08;\u6574\u6570&#xff09;\u4e3a<\/span><span style=\"color:#2f2f2f\">34H<\/span><span style=\"color:#2f2f2f\">&#xff0c;\u4f4e<\/span><span style=\"color:#2f2f2f\">8<\/span><span style=\"color:#2f2f2f\">\u4f4d&#xff08;\u5c0f\u6570&#xff09;\u4e3a<\/span><span style=\"color:#2f2f2f\">01H<\/span><span style=\"color:#2f2f2f\">&#xff0c;\u5c06\u4e24\u90e8\u5206\u6570\u503c\u8f6c\u6362\u4e3a\u5341\u8fdb\u5236\u540e\u53ef\u4ee5\u5f97\u51fa<\/span><span style=\"color:#2f2f2f\">52.1<\/span><span style=\"color:#2f2f2f\">&#xff0c;\u5373\u6e7f\u5ea6\u4e3a<\/span><span style=\"color:#2f2f2f\">52.1%RH<\/span><span style=\"color:#2f2f2f\">\u3002\u540c\u7406\u53ef\u4ee5\u5f97\u51fa\u56fe<\/span><span style=\"color:#2f2f2f\">7<\/span><span style=\"color:#2f2f2f\">\u4e2d\u7684\u6e29\u5ea6\u4e3a<\/span><span style=\"color:#2f2f2f\">-24.12\u2103<\/span><span style=\"color:#2f2f2f\">\u3002\u6b64\u5904\u6e29\u5ea6\u4e3a\u8d1f\u503c\u65f6\u56e0\u4e3a\u6e29\u5ea6\u6570\u636e\u7684\u4f4e<\/span><span style=\"color:#2f2f2f\">8<\/span><span style=\"color:#2f2f2f\">\u4f4d\u7684\u6700\u9ad8\u4f4d<\/span><span style=\"color:#2f2f2f\">Bit7<\/span><span style=\"color:#2f2f2f\">\u4e3a<\/span><span style=\"color:#2f2f2f\">1<\/span><span style=\"color:#2f2f2f\">&#xff1b;\u5f53\u6700\u9ad8\u4f4d<\/span><span style=\"color:#2f2f2f\">Bit7<\/span><span style=\"color:#2f2f2f\">\u4e3a<\/span><span style=\"color:#2f2f2f\">0<\/span><span style=\"color:#2f2f2f\">\u65f6&#xff0c;\u6570\u503c\u4e3a\u6b63\u503c\u3002<\/span><\/p>\n<h2 id=\"%E4%B8%89%E3%80%81%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1\">\u4e09\u3001\u7a0b\u5e8f\u8bbe\u8ba1<\/h2>\n<p style=\"margin-left:0in;text-align:left\"><span style=\"color:#2f2f2f\">1.<\/span><span style=\"color:#2f2f2f\">\u4f7f\u7528<\/span><span style=\"color:#2f2f2f\">STM32F103C8T6<\/span><span style=\"color:#2f2f2f\">\u8bfb\u53d6<\/span><span style=\"color:#2f2f2f\">DHT11<\/span><span style=\"color:#2f2f2f\">\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668<\/span><span style=\"color:#2f2f2f\">\u91c7\u96c6\u7684\u6570\u636e&#xff0c;\u901a\u8fc7\u4e32\u53e3\u53d1\u9001\u81f3\u7535\u8111<\/span><\/p>\n<p style=\"margin-left:0in;text-align:left\"><span style=\"color:#2f2f2f\">2.<\/span><span style=\"color:#2f2f2f\">\u5c06\u8bfb\u53d6\u5f97\u5230\u7684\u6e29\u6e7f\u5ea6\u6570\u636e\u540c\u65f6\u5728<\/span><span style=\"color:#2f2f2f\">OLED<\/span><span style=\"color:#2f2f2f\">\u4e0a\u663e\u793a<\/span><\/p>\n<table cellspacing=\"0\" style=\"width:390pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f1f1f1;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">DHT11<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">PB5<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">OLED_SCL<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">PB11<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">OLED_SDA<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">PB10<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#f1f1f1;border-color:#bcbcbc #e0e0e0;text-align:center;vertical-align:middle;width:137pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"background-color:#f1f1f1\"><span style=\"color:#333333\">\u4e32\u53e3<\/span><\/span><\/p>\n<\/td>\n<td style=\"text-align:center;vertical-align:middle;width:252pt\">\n<p style=\"margin-left:0in;text-align:center\"><span style=\"color:#333333\">\u4e32\u53e3<\/span><span style=\"color:#333333\">1<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"%C2%A0main.c%E6%96%87%E4%BB%B6\">\u00a0main.c\u6587\u4ef6<\/h3>\n<p>#include &#034;stm32f10x.h&#034;<br \/>\n#include &#034;led.h&#034;<br \/>\n#include &#034;usart.h&#034;<br \/>\n#include &#034;delay.h&#034;<br \/>\n#include &#034;dht11.h&#034;<br \/>\n#include &#034;oled.h&#034;<br \/>\n\/*****************\u8fb0\u54e5\u5355\u7247\u673a\u8bbe\u8ba1******************<br \/>\n  STM32<br \/>\n * \u9879\u76ee:1.DHT11\u6e29\u5ea6\u6e7f\u5ea6\u4f20\u611f\u5668\u5b9e\u9a8c<br \/>\n * \u7248\u672c:   V1.0<br \/>\n * \u65e5\u671f:   2024.8.4<br \/>\n * MCU:STM32F103C8T6<br \/>\n * \u63a5\u53e3:\u53c2\u770bDHT11.h<br \/>\n * BILIBILI    :\u8fb0\u54e5\u5355\u7247\u673a\u8bbe\u8ba1<br \/>\n * CSDN:\u8fb0\u54e5\u5355\u7247\u673a\u8bbe\u8ba1<br \/>\n * \u4f5c\u8005:\u8fb0\u54e5 <\/p>\n<p>**********************BEGIN***********************\/<br \/>\nu8 temp;<br \/>\nu8 humi;<br \/>\nint main(void)<br \/>\n{ <\/p>\n<p>  SystemInit();\/\/\u914d\u7f6e\u7cfb\u7edf\u65f6\u949f\u4e3a72M<br \/>\ndelay_init(72);<br \/>\nLED_Init();<br \/>\nLED_On();<br \/>\nUSART1_Config();\/\/\u4e32\u53e3\u521d\u59cb\u5316<br \/>\nOLED_Init();<br \/>\nprintf(&#034;Start \\\\n&#034;);<br \/>\ndelay_ms(1000);<br \/>\nwhile(DHT11_Init())<br \/>\n{<br \/>\nprintf(&#034;DHT11 Error \\\\r\\\\n&#034;);<br \/>\ndelay_ms(1000);<br \/>\n}<br \/>\n\/\/\u663e\u793a\u201c\u6e29\u5ea6&#xff1a;\u201d<br \/>\nOLED_ShowChinese(1,1, 0);<br \/>\nOLED_ShowChinese(1,2, 1);<br \/>\nOLED_ShowChar(1, 5, &#039;:&#039;);<br \/>\nOLED_ShowChar(1, 9, &#039;C&#039;);<br \/>\n\/\/\u663e\u793a\u201c\u6e7f\u5ea6&#xff1a;\u201d<br \/>\nOLED_ShowChinese(2,1, 2);<br \/>\nOLED_ShowChinese(2,2, 1);<br \/>\nOLED_ShowChar(2, 5, &#039;:&#039;);<br \/>\nOLED_ShowChar(2, 9, &#039;%&#039;);<\/p>\n<p>  while (1)<br \/>\n  {<br \/>\nDHT11_Read_Data(&amp;temp,&amp;humi);\/\/<br \/>\nprintf(&#034;temp %d ,humi %d\\\\r\\\\n&#034;,temp,humi);<br \/>\nLED_Toggle();<br \/>\ndelay_ms(1000);<br \/>\n\/\/\u663e\u793a\u6e29\u5ea6\u6570\u636e<br \/>\nOLED_ShowNum(1,6,temp,2);<br \/>\n\/\/\u663e\u793a\u6e7f\u5ea6\u6570\u636e<br \/>\nOLED_ShowNum(2,6,humi,2);<br \/>\n  }<br \/>\n} <\/p>\n<h3 id=\"%C2%A0dht11.h%E6%96%87%E4%BB%B6\">\u00a0dht11.h\u6587\u4ef6<\/h3>\n<p>#ifndef __DHT11_H<br \/>\n#define __DHT11_H<br \/>\n#include &#034;stm32f10x.h&#034;                  \/\/ Device header<br \/>\n#include &#034;delay.h&#034;<\/p>\n<p>\/*****************\u8fb0\u54e5\u5355\u7247\u673a\u8bbe\u8ba1******************<br \/>\n    STM32<br \/>\n * \u6587\u4ef6:DHT11\u6e29\u5ea6\u6e7f\u5ea6\u4f20\u611f\u5668h\u6587\u4ef6<br \/>\n * \u7248\u672c:   V1.0<br \/>\n * \u65e5\u671f:   2024.8.4<br \/>\n * MCU:STM32F103C8T6<br \/>\n * \u63a5\u53e3:\u89c1\u4ee3\u7801<br \/>\n * BILIBILI    :\u8fb0\u54e5\u5355\u7247\u673a\u8bbe\u8ba1<br \/>\n * CSDN:\u8fb0\u54e5\u5355\u7247\u673a\u8bbe\u8ba1<br \/>\n * \u4f5c\u8005:\u8fb0\u54e5<\/p>\n<p>**********************BEGIN***********************<br \/>\n\/***************\u6839\u636e\u81ea\u5df1\u9700\u6c42\u66f4\u6539****************\/<br \/>\n\/\/DHT11\u5f15\u811a\u5b8f\u5b9a\u4e49<br \/>\n#define DHT11_GPIO_PORT  GPIOA<br \/>\n#define DHT11_GPIO_PIN   GPIO_Pin_6<br \/>\n#define DHT11_GPIO_CLK   RCC_APB2Periph_GPIOA<br \/>\n\/*********************END**********************\/<\/p>\n<p>\/\/\u8f93\u51fa\u72b6\u6001\u5b9a\u4e49<br \/>\n#define OUT 1<br \/>\n#define IN  0<\/p>\n<p>\/\/\u63a7\u5236DHT11\u5f15\u811a\u8f93\u51fa\u9ad8\u4f4e\u7535\u5e73<br \/>\n#define DHT11_Low  GPIO_ResetBits(DHT11_GPIO_PORT,DHT11_GPIO_PIN)<br \/>\n#define DHT11_High GPIO_SetBits(DHT11_GPIO_PORT,DHT11_GPIO_PIN)<\/p>\n<p>u8 DHT11_Init(void);\/\/\u521d\u59cb\u5316DHT11<br \/>\nu8 DHT11_Read_Data(u8 *temp,u8 *humi);\/\/\u8bfb\u53d6\u6e29\u6e7f\u5ea6\u6570\u636e<br \/>\nu8 DHT11_Read_Byte(void);\/\/\u8bfb\u53d6\u4e00\u4e2a\u5b57\u8282\u7684\u6570\u636e<br \/>\nu8 DHT11_Read_Bit(void);\/\/\u8bfb\u53d6\u4e00\u4f4d\u7684\u6570\u636e<br \/>\nvoid DHT11_Mode(u8 mode);\/\/DHT11\u5f15\u811a\u8f93\u51fa\u6a21\u5f0f\u63a7\u5236<br \/>\nu8 DHT11_Check(void);\/\/\u68c0\u6d4bDHT11<br \/>\nvoid DHT11_Rst(void);\/\/\u590d\u4f4dDHT11   <\/p>\n<p>#endif<\/p>\n<h3 id=\"dht11.c%E6%96%87%E4%BB%B6\">\u00a0dht11.c\u6587\u4ef6<\/h3>\n<p>#include &#034;dht11.h&#034;<br \/>\n#include &#034;delay.h&#034;<\/p>\n<p>\/*****************\u8fb0\u54e5\u5355\u7247\u673a\u8bbe\u8ba1******************<br \/>\nSTM32<br \/>\n * \u6587\u4ef6:DHT11\u6e29\u5ea6\u6e7f\u5ea6\u4f20\u611f\u5668c\u6587\u4ef6<br \/>\n * \u7248\u672c: V1.0<br \/>\n * \u65e5\u671f: 2024.8.4<br \/>\n * MCU:STM32F103C8T6<br \/>\n * \u63a5\u53e3:\u89c1dht11.h\u6587\u4ef6<br \/>\n * BILIBILI:\u8fb0\u54e5\u5355\u7247\u673a\u8bbe\u8ba1<br \/>\n * CSDN:\u8fb0\u54e5\u5355\u7247\u673a\u8bbe\u8ba1<br \/>\n * \u4f5c\u8005:\u8fb0\u54e5<\/p>\n<p>**********************BEGIN***********************\/<\/p>\n<p>\/\/\u590d\u4f4dDHT11<br \/>\nvoid DHT11_Rst(void)<br \/>\n{<br \/>\nDHT11_Mode(OUT); \/\/SET OUTPUT<br \/>\nDHT11_Low;       \/\/\u62c9\u4f4eDQ<br \/>\ndelay_ms(20);    \/\/\u4e3b\u673a\u62c9\u4f4e18~30ms<br \/>\nDHT11_High; \/\/DQ&#061;1<br \/>\ndelay_us(13);     \/\/\u4e3b\u673a\u62c9\u9ad810~35us<br \/>\n}<\/p>\n<p>\/\/\u7b49\u5f85DHT11\u7684\u56de\u5e94<br \/>\n\/\/\u8fd4\u56de1:\u672a\u68c0\u6d4b\u5230DHT11\u7684\u5b58\u5728<br \/>\n\/\/\u8fd4\u56de0:\u5b58\u5728<br \/>\nu8 DHT11_Check(void)<br \/>\n{<br \/>\nu8 retry&#061;0;<br \/>\nDHT11_Mode(IN);\/\/SET INPUT<br \/>\n    while (GPIO_ReadInputDataBit(DHT11_GPIO_PORT,DHT11_GPIO_PIN)&amp;&amp;retry&lt;100)\/\/DHT11\u4f1a\u62c9\u4f4e40~80us<br \/>\n{<br \/>\nretry&#043;&#043;;<br \/>\ndelay_us(1);<br \/>\n};<br \/>\nif(retry&gt;&#061;100)return 1;<br \/>\nelse retry&#061;0;<br \/>\n    while (!GPIO_ReadInputDataBit(DHT11_GPIO_PORT,DHT11_GPIO_PIN)&amp;&amp;retry&lt;100)\/\/DHT11\u62c9\u4f4e\u540e\u4f1a\u518d\u6b21\u62c9\u9ad840~80us<br \/>\n{<br \/>\nretry&#043;&#043;;<br \/>\ndelay_us(1);<br \/>\n};<br \/>\nif(retry&gt;&#061;100)return 1;<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>\/\/\u4eceDHT11\u8bfb\u53d6\u4e00\u4e2a\u4f4d<br \/>\n\/\/\u8fd4\u56de\u503c&#xff1a;1\/0<br \/>\nu8 DHT11_Read_Bit(void)<br \/>\n{<br \/>\n u8 retry&#061;0;<br \/>\nwhile(GPIO_ReadInputDataBit(DHT11_GPIO_PORT,DHT11_GPIO_PIN)&amp;&amp;retry&lt;100)\/\/\u7b49\u5f85\u53d8\u4e3a\u4f4e\u7535\u5e73<br \/>\n{<br \/>\nretry&#043;&#043;;<br \/>\ndelay_us(1);<br \/>\n}<br \/>\nretry&#061;0;<br \/>\nwhile(!GPIO_ReadInputDataBit(DHT11_GPIO_PORT,DHT11_GPIO_PIN)&amp;&amp;retry&lt;100)\/\/\u7b49\u5f85\u53d8\u9ad8\u7535\u5e73<br \/>\n{<br \/>\nretry&#043;&#043;;<br \/>\ndelay_us(1);<br \/>\n}<br \/>\ndelay_us(40);\/\/\u7b49\u5f8540us<br \/>\nif(GPIO_ReadInputDataBit(DHT11_GPIO_PORT,DHT11_GPIO_PIN))return 1;<br \/>\nelse return 0;<br \/>\n}<\/p>\n<p>\/\/\u4eceDHT11\u8bfb\u53d6\u4e00\u4e2a\u5b57\u8282<br \/>\n\/\/\u8fd4\u56de\u503c&#xff1a;\u8bfb\u5230\u7684\u6570\u636e<br \/>\nu8 DHT11_Read_Byte(void)<br \/>\n{<br \/>\nu8 i,dat;<br \/>\ndat&#061;0;<br \/>\nfor (i&#061;0;i&lt;8;i&#043;&#043;)<br \/>\n{<br \/>\ndat&lt;&lt;&#061;1;<br \/>\ndat|&#061;DHT11_Read_Bit();<br \/>\n}<br \/>\nreturn dat;<br \/>\n}<br \/>\n\/\/\u4eceDHT11\u8bfb\u53d6\u4e00\u6b21\u6570\u636e<br \/>\n\/\/temp:\u6e29\u5ea6\u503c(\u8303\u56f4:0~50\u00b0)<br \/>\n\/\/humi:\u6e7f\u5ea6\u503c(\u8303\u56f4:20%~90%)<br \/>\n\/\/\u8fd4\u56de\u503c&#xff1a;0,\u6b63\u5e38;1,\u8bfb\u53d6\u5931\u8d25<br \/>\nu8 DHT11_Read_Data(u8 *temp,u8 *humi)<br \/>\n{<br \/>\n u8 buf[5];<br \/>\nu8 i;<br \/>\nDHT11_Rst();<br \/>\nif(DHT11_Check()&#061;&#061;0)<br \/>\n{<br \/>\nfor(i&#061;0;i&lt;5;i&#043;&#043;)\/\/\u8bfb\u53d640\u4f4d\u6570\u636e<br \/>\n{<br \/>\nbuf[i]&#061;DHT11_Read_Byte();<br \/>\n}<br \/>\nif((buf[0]&#043;buf[1]&#043;buf[2]&#043;buf[3])&#061;&#061;buf[4])<br \/>\n{<br \/>\n*humi&#061;buf[0];<br \/>\n*temp&#061;buf[2];<br \/>\n}<br \/>\n}<br \/>\nelse return 1;<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>\/\/\u521d\u59cb\u5316DHT11\u7684IO\u53e3 DQ \u540c\u65f6\u68c0\u6d4bDHT11\u7684\u5b58\u5728<br \/>\n\/\/\u8fd4\u56de1:\u4e0d\u5b58\u5728<br \/>\n\/\/\u8fd4\u56de0:\u5b58\u5728<br \/>\nu8 DHT11_Init(void)<br \/>\n{<br \/>\n GPIO_InitTypeDef  GPIO_InitStructure;<br \/>\n RCC_APB2PeriphClockCmd(DHT11_GPIO_CLK, ENABLE); \/\/\u4f7f\u80fdPA\u7aef\u53e3\u65f6\u949f<br \/>\n GPIO_InitStructure.GPIO_Pin &#061; DHT11_GPIO_PIN; \/\/PG11\u7aef\u53e3\u914d\u7f6e<br \/>\n GPIO_InitStructure.GPIO_Mode &#061; GPIO_Mode_Out_PP;  \/\/\u63a8\u633d\u8f93\u51fa<br \/>\n GPIO_InitStructure.GPIO_Speed &#061; GPIO_Speed_50MHz;<br \/>\n GPIO_Init(DHT11_GPIO_PORT, &amp;GPIO_InitStructure); \/\/\u521d\u59cb\u5316IO\u53e3<br \/>\n GPIO_SetBits(DHT11_GPIO_PORT,DHT11_GPIO_PIN); \/\/PG11 \u8f93\u51fa\u9ad8<\/p>\n<p>DHT11_Rst();  \/\/\u590d\u4f4dDHT11<br \/>\nreturn DHT11_Check();\/\/\u7b49\u5f85DHT11\u7684\u56de\u5e94<br \/>\n}<br \/>\nvoid DHT11_Mode(u8 mode)<br \/>\n{<br \/>\nGPIO_InitTypeDef GPIO_InitStructure;<br \/>\nif(mode)<br \/>\n{<br \/>\nGPIO_InitStructure.GPIO_Pin &#061; DHT11_GPIO_PIN;<br \/>\nGPIO_InitStructure.GPIO_Speed &#061; GPIO_Speed_50MHz;<br \/>\nGPIO_InitStructure.GPIO_Mode &#061; GPIO_Mode_Out_PP;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nGPIO_InitStructure.GPIO_Pin &#061;  DHT11_GPIO_PIN;<br \/>\nGPIO_InitStructure.GPIO_Mode &#061; GPIO_Mode_IN_FLOATING;<br \/>\n}<br \/>\nGPIO_Init(DHT11_GPIO_PORT, &amp;GPIO_InitStructure);<br \/>\n}<\/p>\n<h2 id=\"%E5%9B%9B%E3%80%81%E5%AE%9E%E9%AA%8C%E6%95%88%E6%9E%9C%E5%B1%95%E7%A4%BA\">\u56db\u3001\u5b9e\u9a8c\u6548\u679c\u5c55\u793a<\/h2>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005431-6848d3c7aac59.jpg\" \/><\/p>\n<h2 id=\"%C2%A0%E4%BA%94%E3%80%81%E8%B5%84%E6%96%99%E8%8E%B7%E5%8F%96\">\u00a0\u4e94\u3001\u8d44\u6599\u83b7\u53d6<\/h2>\n<h3 id=\"%C2%A0%C2%A0%E9%A1%B9%E7%9B%AE%E5%88%86%E4%BA%AB\">\u00a0\u00a0\u9879\u76ee\u5206\u4eab<\/h3>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.1w\u6b21\uff0c\u70b9\u8d5e90\u6b21\uff0c\u6536\u85cf361\u6b21\u3002DHT11\u662f\u4e00\u6b3e\u542b\u6709\u5df2\u6821\u51c6\u6570\u5b57\u4fe1\u53f7\u8f93\u51fa\u7684\u6e29\u6e7f\u5ea6\u590d\u5408\u4f20\u611f\u5668\uff0c\u91c7\u7528\u4e86\u81ea\u4e3b\u7814\u53d1\u7684\u96c6\u6210\u5f0f\u6570\u5b57\u6e29\u6e7f\u5ea6\u5143\u4ef6\uff0c\u5e94\u7528\u4e13\u7528\u7684\u6570\u5b57\u6a21\u5757\u91c7\u96c6\u6280\u672f\u548c\u6e29\u6e7f\u5ea6\u4f20\u611f\u6280\u672f\uff0c\u786e\u4fdd\u4ea7\u54c1\u5177\u6709\u6781\u9ad8\u7684\u53ef\u9760\u6027\u4e0e\u5353\u8d8a\u7684\u957f\u671f\u7a33\u5b9a\u6027\u3002DHT11\u4f20\u611f\u5668\u5185\u5305\u542b\u4e00\u4e2a\u6e29\u6e7f\u5ea6\u6d4b\u91cf\u5143\u4ef6\u548c\u4e00\u4e2a\u9ad8\u6027\u80fdMCU\u3002\u4ee5\u4e0b\u662fDHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u7684\u53c2\u6570\uff1a\u4f9b\u7535\u7535\u538b\u5de5\u4f5c\u8303\u56f4\u6e29\u5ea6-20~+60\u2103\u91cf\u7a0b\u8303\u56f4\u6e7f\u5ea65~95%RH\u6e29\u5ea6\u7cbe\u5ea6\u00b12\u2103\u6e7f\u5ea6\u7cbe\u5ea6\u00b15%RH\u91cd\u590d\u6027\u6e29\u5ea6\uff1a\u00b11\u2103\uff1b\u6e7f\u5ea6\uff1a\u00b11%RH\u8fdf\u6ede\u6e29\u5ea6\u00b10.3\u2103\u8fdf\u6ede\u6e7f\u5ea6\u00b10.3%RH\u3002_dht11<\/p>\n","protected":false},"author":2,"featured_media":43056,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[217,3993,3994,270,269],"topic":[],"class_list":{"0":"post-43066","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-server","8":"tag-stm32","10":"tag-3994","11":"tag-270","12":"tag-269"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>DHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u8be6\u89e3\uff08STM32\uff09 - \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\/43066.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u8be6\u89e3\uff08STM32\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.1w\u6b21\uff0c\u70b9\u8d5e90\u6b21\uff0c\u6536\u85cf361\u6b21\u3002DHT11\u662f\u4e00\u6b3e\u542b\u6709\u5df2\u6821\u51c6\u6570\u5b57\u4fe1\u53f7\u8f93\u51fa\u7684\u6e29\u6e7f\u5ea6\u590d\u5408\u4f20\u611f\u5668\uff0c\u91c7\u7528\u4e86\u81ea\u4e3b\u7814\u53d1\u7684\u96c6\u6210\u5f0f\u6570\u5b57\u6e29\u6e7f\u5ea6\u5143\u4ef6\uff0c\u5e94\u7528\u4e13\u7528\u7684\u6570\u5b57\u6a21\u5757\u91c7\u96c6\u6280\u672f\u548c\u6e29\u6e7f\u5ea6\u4f20\u611f\u6280\u672f\uff0c\u786e\u4fdd\u4ea7\u54c1\u5177\u6709\u6781\u9ad8\u7684\u53ef\u9760\u6027\u4e0e\u5353\u8d8a\u7684\u957f\u671f\u7a33\u5b9a\u6027\u3002DHT11\u4f20\u611f\u5668\u5185\u5305\u542b\u4e00\u4e2a\u6e29\u6e7f\u5ea6\u6d4b\u91cf\u5143\u4ef6\u548c\u4e00\u4e2a\u9ad8\u6027\u80fdMCU\u3002\u4ee5\u4e0b\u662fDHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u7684\u53c2\u6570\uff1a\u4f9b\u7535\u7535\u538b\u5de5\u4f5c\u8303\u56f4\u6e29\u5ea6-20~+60\u2103\u91cf\u7a0b\u8303\u56f4\u6e7f\u5ea65~95%RH\u6e29\u5ea6\u7cbe\u5ea6\u00b12\u2103\u6e7f\u5ea6\u7cbe\u5ea6\u00b15%RH\u91cd\u590d\u6027\u6e29\u5ea6\uff1a\u00b11\u2103\uff1b\u6e7f\u5ea6\uff1a\u00b11%RH\u8fdf\u6ede\u6e29\u5ea6\u00b10.3\u2103\u8fdf\u6ede\u6e7f\u5ea6\u00b10.3%RH\u3002_dht11\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/43066.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-11T00:54:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005426-6848d3c296ce8.jpg\" \/>\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\/43066.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/43066.html\",\"name\":\"DHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u8be6\u89e3\uff08STM32\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-11T00:54:35+00:00\",\"dateModified\":\"2025-06-11T00:54:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/43066.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/43066.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/43066.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u8be6\u89e3\uff08STM32\uff09\"}]},{\"@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":"DHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u8be6\u89e3\uff08STM32\uff09 - \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\/43066.html","og_locale":"zh_CN","og_type":"article","og_title":"DHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u8be6\u89e3\uff08STM32\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.1w\u6b21\uff0c\u70b9\u8d5e90\u6b21\uff0c\u6536\u85cf361\u6b21\u3002DHT11\u662f\u4e00\u6b3e\u542b\u6709\u5df2\u6821\u51c6\u6570\u5b57\u4fe1\u53f7\u8f93\u51fa\u7684\u6e29\u6e7f\u5ea6\u590d\u5408\u4f20\u611f\u5668\uff0c\u91c7\u7528\u4e86\u81ea\u4e3b\u7814\u53d1\u7684\u96c6\u6210\u5f0f\u6570\u5b57\u6e29\u6e7f\u5ea6\u5143\u4ef6\uff0c\u5e94\u7528\u4e13\u7528\u7684\u6570\u5b57\u6a21\u5757\u91c7\u96c6\u6280\u672f\u548c\u6e29\u6e7f\u5ea6\u4f20\u611f\u6280\u672f\uff0c\u786e\u4fdd\u4ea7\u54c1\u5177\u6709\u6781\u9ad8\u7684\u53ef\u9760\u6027\u4e0e\u5353\u8d8a\u7684\u957f\u671f\u7a33\u5b9a\u6027\u3002DHT11\u4f20\u611f\u5668\u5185\u5305\u542b\u4e00\u4e2a\u6e29\u6e7f\u5ea6\u6d4b\u91cf\u5143\u4ef6\u548c\u4e00\u4e2a\u9ad8\u6027\u80fdMCU\u3002\u4ee5\u4e0b\u662fDHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u7684\u53c2\u6570\uff1a\u4f9b\u7535\u7535\u538b\u5de5\u4f5c\u8303\u56f4\u6e29\u5ea6-20~+60\u2103\u91cf\u7a0b\u8303\u56f4\u6e7f\u5ea65~95%RH\u6e29\u5ea6\u7cbe\u5ea6\u00b12\u2103\u6e7f\u5ea6\u7cbe\u5ea6\u00b15%RH\u91cd\u590d\u6027\u6e29\u5ea6\uff1a\u00b11\u2103\uff1b\u6e7f\u5ea6\uff1a\u00b11%RH\u8fdf\u6ede\u6e29\u5ea6\u00b10.3\u2103\u8fdf\u6ede\u6e7f\u5ea6\u00b10.3%RH\u3002_dht11","og_url":"https:\/\/www.wsisp.com\/helps\/43066.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-11T00:54:35+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250611005426-6848d3c296ce8.jpg"}],"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\/43066.html","url":"https:\/\/www.wsisp.com\/helps\/43066.html","name":"DHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u8be6\u89e3\uff08STM32\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-11T00:54:35+00:00","dateModified":"2025-06-11T00:54:35+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/43066.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/43066.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/43066.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"DHT11\u6e29\u6e7f\u5ea6\u4f20\u611f\u5668\u8be6\u89e3\uff08STM32\uff09"}]},{"@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\/43066","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=43066"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/43066\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/43056"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=43066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=43066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=43066"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=43066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}