{"id":9900,"date":"2023-03-23T21:49:29","date_gmt":"2023-03-23T13:49:29","guid":{"rendered":"https:\/\/blog.iyatt.com\/?p=9900"},"modified":"2024-05-05T14:18:11","modified_gmt":"2024-05-05T06:18:11","slug":"%e9%a3%8e%e6%89%87%e6%a8%a1%e5%9e%8b%ef%bc%88%e7%bc%96%e8%be%91%e4%b8%ad%ef%bc%89","status":"publish","type":"post","link":"https:\/\/blog.iyatt.com\/?p=9900","title":{"rendered":"\u98ce\u6247\u6a21\u578b &#8211; \u6298\u817e\u4e00"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title ez-toc-toggle\" style=\"cursor:pointer\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.iyatt.com\/?p=9900\/#%E5%89%8D%E8%A8%80\" >\u524d\u8a00<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.iyatt.com\/?p=9900\/#%E6%8E%A5%E7%BA%BF\" >\u63a5\u7ebf<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.iyatt.com\/?p=9900\/#%E8%BD%AF%E4%BB%B6%E7%8E%AF%E5%A2%83\" >\u8f6f\u4ef6\u73af\u5883<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blog.iyatt.com\/?p=9900\/#%E4%BB%A3%E7%A0%81\" >\u4ee3\u7801<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E5%89%8D%E8%A8%80\"><\/span>\u524d\u8a00<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u524d\u51e0\u5929\u505a\u4e86\u4e00\u4e2a\u673a\u5668\u4eba\u7efc\u5408\u521b\u65b0\u5b9e\u9a8c\uff0c\u8001\u5e08\u8ba9\u6211\u4eec\u8bbe\u8ba1\u4e00\u4e2a\u4e1c\u897f\uff0c\u7136\u540e\u505a\u4e00\u5b9a\u5b9e\u73b0\uff0c\u56e0\u4e3a\u548c\u6211\u4eec\u4e13\u4e1a\u5173\u7cfb\u4e0d\u662f\u5f88\u5927\uff0c\u6240\u4ee5\u5bf9\u4e8e\u5b9e\u73b0\u65b9\u9762\u5e76\u6ca1\u6709\u5f88\u9ad8\u7684\u8981\u6c42\uff0c\u4e3b\u8981\u662f PPT \u80fd\u591f\u505a\u63cf\u8ff0\u5c31\u884c\u3002\u7136\u540e\u8bfe\u4e0a\u6211\u4eec\u7ec4\u5546\u8bae\u540e\u51b3\u5b9a\u505a\u4e00\u4e2a\u667a\u80fd\u98ce\u6247\u76f8\u5173\u7684\uff0c\u5c31\u5148\u5728 tb \u4e0a\u4e70\u4e86\u4e00\u4e2a\u611f\u5e94\u98ce\u6247\u7684\u6210\u54c1\u96f6\u4ef6\uff0c\u6628\u5929\u5feb\u9012\u5230\u4e86\uff0c\u6211\u7528\u4e86\u4e00\u665a\u4e0a\u52a0\u4eca\u5929\u4e00\u4e2a\u4e0a\u5348\u6298\u817e\u51fa\u4e86\u672c\u6587\u7684\u5185\u5bb9\uff08\u90fd\u77e5\u9053\u6211\u5728\u8fd9\u65b9\u9762\u61c2\u5f97\u591a\u4e00\u70b9\u70b9\uff0c\u6240\u4ee5\u5c31\u662f\u6211\u505a\u5b9e\u64cd\u4e86\uff09<\/p>\n<p>\u505a\u51fa\u8fd9\u4e2a\u4ee5\u540e\uff0c\u6211\u518d\u53bb\u770b\u4e86\u8001\u5e08\u7ed9\u7684\u4e24\u4e2a\u5e97\u94fa\uff0c\u8981\u4e70\u7684\u96f6\u4ef6\u53ef\u4ee5\u62a5\u7ed9\u8001\u5e08\u7edf\u4e00\u7ecf\u8d39\u8d2d\u4e70\u3002\u6328\u7740\u7ffb\u4e86\u4e00\u904d\uff0c\u6211\u53c8\u6709\u4e86\u65b0\u7684\u6784\u60f3\uff0c\u51d1\u4e86\u4e5d\u5341\u51e0\u5757\u94b1\u7684\u4e1c\u897f\uff08\u8d85\u8fc7100\u8981\u5355\u72ec\u7ed9\u8001\u5e08\u8bf4\u660e\uff0c\u6ca1\u5fc5\u8981\u4e86\uff09\uff0c\u7b49\u540e\u9762\u8001\u5e08\u4e70\u597d\u4e86\uff0c\u6211\u518d\u505a\u65b0\u6784\u60f3\u7684\u4e1c\u897f\uff0c\u540e\u7eed\u518d\u5199\u7eed\u7bc7\u3002<\/p>\n<hr \/>\n<p>\u8fd9\u91cc\u7ec4\u5185\u81ea\u5df1\u82b1\u94b1\u4e70\u7684\u611f\u5e94\u98ce\u6247\u6210\u54c1\u96f6\u4ef6\uff0c\u4e3b\u4f53\u6846\u67b6\u662f\u6728\u8d28\u7684\uff0c\u6211\u5df2\u7ecf\u62fc\u597d\u4e86<br \/>\n\u8fd9\u4e2a\u56fe\u4e0a\u5305\u542b\u4e86\u4e00\u4e2a\u7535\u673a\u548c\u4e00\u4e2aLED\u6307\u793a\u706f\uff0c\u8ba1\u5212\u4fdd\u7559\u4f7f\u7528<br \/>\nLED \u9664\u4e86\u63a5\u6b63\u8d1f\u6781\uff0c\u8fd8\u6709\u4e00\u4e2a S \u6781\uff0c\u7ed9\u6b63\u7535\u538b\u65f6 LED \u624d\u4f1a\u4eae<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679576870508.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 506px; --smush-placeholder-aspect-ratio: 506\/872;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679579855291.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 287px; --smush-placeholder-aspect-ratio: 287\/378;\" \/><\/p>\n<p>\u8fd9\u4e2a\u662f\u7535\u673a\u9a71\u52a8\u677f\u3002\u5148\u6d4b\u8bd5\u4e86\u4e00\u4e0b\uff0c\u5927\u81f4\u5f04\u660e\u767d\u4e86\u63a7\u5236\u539f\u7406\u3002V \u5c31\u662f\u6b63\u6781\uff08\u8fd9\u91cc\u7528 5V\uff09\uff0cG \u5c31\u662f GND\uff0cIN-B \u548c IN-A \u7528\u4e8e\u63a7\u5236\u7535\u673a\u8fd0\u8f6c\u7684\uff0c\u7ed9 B \u52a0\u6b63\u6781\u7535\u538b\uff0c\u98ce\u6247\u5c31\u662f\u6b63\u8f6c\u9001\u98ce\uff08\u6240\u4ee5\u56fa\u5b9a\u7528\u8fd9\u4e2a\u5f15\u811a\u8f93\u5165\uff09\uff0c\u7ed9 A \u52a0\u6b63\u6781\u7535\u538b\u5c31\u662f\u53cd\u5411\uff0c\u5176\u5b9e\u5c31\u662f\u63a7\u5236\u53f3\u8fb9 OUT \u54ea\u4e2a\u662f\u8d1f\u6781\uff0c\u5de6\u8fb9 B \u7ed9\u6b63\u7535\u538b\uff0c\u53f3\u8fb9 B \u5c31\u662f\u8d1f\u6781\uff0c\u5de6\u8fb9 A \u7ed9\u6b63\u7535\u538b\uff0c\u53f3\u8fb9 A \u5c31\u662f\u8d1f\u6781\u3002\u53e6\u5916\u6839\u636e\u7ed9\u7684\u6b63\u7535\u538b\u76f8\u6bd4\u4e8e GND \u7684\u5927\u5c0f\uff0c\u8f93\u51fa\u7684 AB \u95f4\u7684\u7535\u538b\u4e5f\u4f1a\u8ddf\u968f\u53d8\u5927\u53d8\u5c0f\uff0c\u6240\u4ee5\u53ef\u4ee5\u901a\u8fc7\u63a7\u5236\u5de6\u8fb9\u8f93\u5165\u4fe1\u53f7\u7535\u538b\u7684\u9ad8\u4f4e\u8c03\u8282\u98ce\u901f\u3002\u8fd9\u4e2a\u6a21\u5757\u4e5f\u8ba1\u5212\u4fdd\u7559\u4f7f\u7528<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679576932590.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 517px; --smush-placeholder-aspect-ratio: 517\/323;\" \/><\/p>\n<p>\u8fd9\u4e2a\u5c31\u662f\u63a7\u5236\u677f\u3002\u7535\u673a\u9a71\u52a8\u677f\u6700\u7ec8\u5c31\u63a5\u5728\u8fd9\u4e0a\u9762\uff0c\u4eba\u4f53\u611f\u5e94\u5668\u3001LED \u6307\u793a\u706f\u90fd\u662f\u63a5\u5728\u8fd9\u4e0a\u9762\uff0c\u7136\u540e DC \u63a5\u53e3\u8f93\u5165\u63a5\u4e00\u4e2a\u7535\u6c60\u76d2\u88c5 3 \u8282 5 \u53f7\u7535\u6c60\uff0c\u4e5f\u5c31\u662f 4.5V \u4f9b\u7535\uff0c\u6211\u8bd5\u8fc7\u7528 5V \u4e5f\u884c\uff0c\u8fd9\u4e2a\u6a21\u5757\u8ba1\u5212\u4e2d\u4e0d\u4f7f\u7528\uff0c\u76f4\u63a5\u7528 Arduino \u66ff\u4ee3\uff0c\u5c31\u80fd\u6839\u636e\u9700\u8981\u6269\u5c55\u529f\u80fd\uff0c\u903b\u8f91\u4e5f\u80fd\u81ea\u5df1\u7f16\u5199<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679577669701.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 297px; --smush-placeholder-aspect-ratio: 297\/406;\" \/><\/p>\n<p>\u8fd9\u4e2a\u5c31\u662f\u4eba\u4f53\u611f\u5e94\u4f20\u611f\u5668\u3002\u5b9e\u9645\u5c31\u662f\u68c0\u6d4b\u7ea2\u5916\u7ebf\uff0c\u5927\u6982\u63a5\u8fd1\u4eba\u4f53\u4f53\u6e29\u7684\u4e1c\u897f\u79fb\u52a8\u5c31\u80fd\u89e6\u53d1\u3002\u8fd9\u4f20\u611f\u5668\u4e0a\u9762\u4e5f\u6709\u4e2a\u6307\u793a\u706f\uff0c\u89e6\u53d1\u65f6\u4f1a\u4eae\u8d77\u6765\uff0c\u7136\u540e S \u8f93\u51fa\u9ad8\u7535\u5e73\u3002<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679577887555.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 235px; --smush-placeholder-aspect-ratio: 235\/376;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679577898656.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 240px; --smush-placeholder-aspect-ratio: 240\/303;\" \/><\/p>\n<p>\u8fd8\u6709\u4e2a\u7535\u6c60\u76d2\uff0c\u8fd9\u4e2a\u5c31\u6ca1\u5565\u8bf4\u7684\u4e86\uff0c\u7528\u6765\u63d2\u63a7\u5236\u677f\u4e0a\u4f9b\u7535\uff0c\u8ba1\u5212\u4e5f\u4e0d\u4f7f\u7528\u5b83\uff0c\u76f4\u63a5\u7528\u5145\u7535\u5b9d\u8f93\u5165 5V<\/p>\n<p>\u4e0a\u9762\u7684\u5c31\u662f\u8d2d\u4e70\u7684\u6210\u54c1\u4e3b\u8981\u5143\u5668\u4ef6\u4e86\uff0c\u7136\u540e\u6211\u5b9e\u73b0\u7684\u65f6\u5019\u6dfb\u52a0\u7684\u81ea\u5df1\u7684\u5143\u5668\u4ef6\uff1a<\/p>\n<ul>\n<li>\n<p>Arduino UNO<br \/>\n\u7528\u6765\u4f5c\u63a7\u5236\u677f<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679578437154.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 447px; --smush-placeholder-aspect-ratio: 447\/353;\" \/><\/p>\n<\/li>\n<li>\n<p>LCD 1602\uff08I2C \u63a5\u53e3\uff09<br \/>\n\u7528\u6765\u663e\u793a\u5f00\u5173\u72b6\u6001\u548c\u98ce\u6247\u7535\u673a\u4f9b\u7ed9\u7684\u7535\u538b\u5927\u5c0f\u7b49\u7ea7\uff0c\u4ee5\u53ca\u6e29\u5ea6<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679630676534.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 848px; --smush-placeholder-aspect-ratio: 848\/496;\" \/><\/p>\n<\/li>\n<li>\n<p>\u89e6\u6478\u5f00\u5173<br \/>\n\u7528\u4e8e\u63a7\u5236\u7535\u673a\u7684\u7684\u8f93\u5165\u4fe1\u53f7\u6e90\u5f00\u65ad<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679630811701.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 311px; --smush-placeholder-aspect-ratio: 311\/359;\" \/><\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<p>2023.5.1<\/p>\n<p>\u5728\u6298\u817e\u4e8c\u7684\u65f6\u5019\uff0c\u53d1\u73b0\u6211\u641e\u9519\u4e86\uff0c\u6240\u4ee5\u672c\u6587\u5173\u4e8e\u89e6\u6478\u6309\u94ae\u63a7\u5236\u7684\u4ee3\u7801\u5e94\u8be5\u662f\u5b58\u5728\u95ee\u9898\u7684\u3002\u6211\u53d1\u73b0\u8fd9\u4e2a\u89e6\u6478\u6309\u94ae\u548c\u666e\u901a\u7684\u6309\u952e\u6309\u94ae\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u5b83\u81ea\u5df1\u4f1a\u8bb0\u5f55\u5f00\u5173\u72b6\u6001\uff0c\u521d\u59cb\u662f\u8f93\u51fa\u4f4e\u7535\u5e73\uff0c\u6478\u4e00\u6b21\u540e\u5b83\u5c31\u4e00\u76f4\u8f93\u51fa\u9ad8\u7535\u5e73\uff0c\u518d\u6478\u4e00\u6b21\u5b83\u624d\u53d8\u6210\u4f4e\u7535\u5e73\u3002\u6211\u662f\u5f53\u6210\u666e\u901a\u6309\u94ae\u6765\u7528\u5199\u4ee3\u7801\u903b\u8f91\u7684\uff1a\u6309\u4e0b\u4e0d\u653e\u5c31\u4e00\u76f4\u662f\u9ad8\u7535\u5e73\uff0c\u53ea\u8981\u653e\u5f00\u5c31\u53d8\u4f4e\u7535\u5e73\u3002\u5f53\u65f6\u6211\u4e5f\u53d1\u73b0\u4e0d\u5bf9\u7ecf\uff0c\u4f46\u662f\u6ca1\u610f\u8bc6\u5230\u8fd9\u79cd\u60c5\u51b5\uff0c\u8fd8\u8bef\u6253\u8bef\u649e\u7684\u8ba9\u7a0b\u5e8f\u6070\u597d\u201c\u6b63\u5e38\u201d\u5de5\u4f5c\u4e86\u3002\u5f53\u7136\uff0c\u8fd9\u5f00\u5173\u81ea\u5df1\u80fd\u8bb0\u5f55\u72b6\u6001\uff0c\u4e5f\u5c31\u4e0d\u9700\u8981\u4ee3\u7801\u903b\u8f91\u53bb\u5b9e\u73b0\u4e86\uff0c\u53cd\u800c\u66f4\u7b80\u5355\u4e86\u3002<\/p>\n<ul>\n<li>\n<p>DS18B20 \u6e29\u5ea6\u4f20\u611f\u5668<br \/>\n\u7528\u4e8e\u6d4b\u5ba4\u6e29<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679631076296.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 287px; --smush-placeholder-aspect-ratio: 287\/254;\" \/><\/p>\n<\/li>\n<li>\n<p>\u7535\u78c1\u7ee7\u7535\u5668\uff08\u4e00\u8def\uff09<br \/>\n\u89e6\u6478\u6309\u94ae\u6700\u7ec8\u5c31\u662f\u4f5c\u7528\u4e8e\u8fd9\u4e2a\u7535\u78c1\u7ee7\u7535\u5668\u7528\u4e8e\u63a7\u5236\u7535\u673a\u8f93\u5165\u4fe1\u53f7\u7684\u5f00\u65ad<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679631233286.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 552px; --smush-placeholder-aspect-ratio: 552\/280;\" \/><\/p>\n<\/li>\n<li>\n<p>\u7535\u4f4d\u5668<br \/>\n\u7528\u4e8e\u63a7\u5236\u7535\u673a\u9a71\u52a8\u677f\u4fe1\u53f7\u8f93\u5165\u7aef\u7684\u7535\u538b\u5927\u5c0f\uff0c\u8fdb\u800c\u63a7\u5236\u98ce\u6247\u7684\u8f6c\u901f<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679631387979.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 508px; --smush-placeholder-aspect-ratio: 508\/342;\" \/><\/p>\n<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"%E6%8E%A5%E7%BA%BF\"><\/span>\u63a5\u7ebf<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u753b\u4e86\u5f20\u8349\u56fe\uff0c\u633a\u4e11\u7684\u54c8\u54c8<br \/>\n\u7ea2\u8272\u4ee3\u8868\u6b63\u6781\uff085V\uff09<br \/>\n\u9ed1\u8272\u4ee3\u8868 GND<br \/>\n\u84dd\u8272\u4ee3\u8868\u4fe1\u53f7<br \/>\n\u6253\u53c9\u7684\u5730\u65b9\u4ee3\u8868\u7ebf\u662f\u63a5\u5728\u4e00\u8d77\u7684<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679633086636.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 1000px; --smush-placeholder-aspect-ratio: 1000\/652;\" \/><\/p>\n<p>\u6700\u5f00\u59cb\u7535\u673a\u6211\u662f\u7528 Arduino \u4f9b\u7535\u7684\uff0c\u4f46\u662f\u53d1\u73b0\u7535\u673a\u4e00\u8fd0\u884c\u8d77\u6765\u5c31\u5bfc\u81f4 5V \u63a5\u53e3\u964d\u538b\uff0c\u5f71\u54cd\u5176\u5b83\u96f6\u4ef6\u5de5\u4f5c\uff0c\u6240\u4ee5\u7ed9\u7535\u673a\u5355\u72ec\u4f7f\u7528\u4e00\u4e2a\u7535\u6e90\u3002<\/p>\n<hr \/>\n<p><strong>2023.4.30<\/strong><\/p>\n<p>\u5728\u6298\u817e\u4e8c\u65f6\uff0c\u53d1\u73b0\u5fd8\u8bb0\u753b LCD1602 \u7684\u63a5\u7ebf\u4e86\uff0c\u8fd9\u91cc\u8865\u5145 SDA &#8211; A4\uff0cSCL &#8211; A5<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E8%BD%AF%E4%BB%B6%E7%8E%AF%E5%A2%83\"><\/span>\u8f6f\u4ef6\u73af\u5883<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Arduino IDE 2.0.4<br \/>\nArduino \u5e93\uff1a<\/p>\n<ul>\n<li>LiquidCrystal I2C (by Frank de Brabander) 1.1.2<\/li>\n<li>OneWire (by Jim Studt&#8230;) 2.3.7<\/li>\n<li>Dallas Temperature (by Miles Burton) 3.9.0<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"%E4%BB%A3%E7%A0%81\"><\/span>\u4ee3\u7801<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre><code class=\"language-cpp\">#include &lt;Wire.h&gt; \n#include &lt;LiquidCrystal_I2C.h&gt;\n#include &lt;OneWire.h&gt;\n#include &lt;DallasTemperature.h&gt;\n\n\/\/ \u5f15\u811a\n#define FAN_VOLTAGE_PIN         A0 \/\/ \u8bfb\u53d6\u7535\u673a\u9a71\u52a8\u677f\u8f93\u5165\u4fe1\u53f7\u7535\u538b\u5927\u5c0f\n#define POWER_SWITCH_PIN        8 \/\/ \u8bfb\u53d6\u89e6\u6478\u6309\u94ae\u72b6\u6001\n#define ELECTRO_RELAY_PIN       9 \/\/ \u63a7\u5236\u7535\u78c1\u7ee7\u7535\u5668\n#define TEMPERATURE_PIN         10 \/\/ \u8bfb\u53d6\u6e29\u5ea6\u4f20\u611f\u5668\u6570\u636e\n#define HUMAN_BODY_PIN          11 \/\/ \u8bfb\u53d6\u4eba\u4f53\u611f\u5e94\u4f20\u611f\u5668\u72b6\u6001\n\n\/\/ \u6e29\u5ea6\u4f20\u611f\u5668\nOneWire oneWire(TEMPERATURE_PIN); \/\/ \u521b\u5efa\u5355\u603b\u7ebf\u5f15\u811a\nDallasTemperature temperature(&amp;oneWire); \/\/ \u6e29\u5ea6\u4f20\u611f\u5668\u5b9e\u4f8b\n\n\/\/ LCD \u5b9e\u4f8b\nLiquidCrystal_I2C lcd(0x27, 16, 2);\n\nvoid setup()\n{\n    \/\/ LCD \u521d\u59cb\u5316\n    lcd.init();\n    lcd.backlight();\n    lcd.clear();\n\n    \/\/ \u5f15\u811a\u521d\u59cb\u5316\n    pinMode(A0, INPUT);\n    pinMode(POWER_SWITCH_PIN, INPUT_PULLUP);\n    pinMode(ELECTRO_RELAY_PIN, OUTPUT);\n\n    \/\/ \u521d\u59cb\u5316\u6e29\u5ea6\u4f20\u611f\u5668\n    temperature.begin();\n}\nvoid loop()\n{\n    static bool powerStatus = false; \/\/ \u7535\u6e90\u72b6\u6001\n    static int powerSwitchStatus = LOW; \/\/ \u7535\u6e90\u5f00\u5173\u72b6\u6001\n    static unsigned int startTime = 0; \/\/ \u5f00\u5173\u957f\u6309\u8ba1\u65f6\n    static int lastPowerSwitchStatus = LOW; \/\/ \u4e0a\u4e00\u6b21\u7684\u7535\u6e90\u5f00\u5173\u72b6\u6001\n    static char lcdString[17]; \/\/ \u7f13\u51b2 LCD \u5c4f\u663e\u793a\u5185\u5bb9\n    static float temperatureC = 0; \/\/ \u6e29\u5ea6\u503c\n\n    \/\/ \u8bfb\u53d6\u6e29\u5ea6\n    temperature.requestTemperatures();\n    temperatureC = temperature.getTempCByIndex(0);\n\n    \/\/ \u7535\u6e90\u5f00\u5173\n    powerSwitchStatus = digitalRead(POWER_SWITCH_PIN);\n    if (powerSwitchStatus != lastPowerSwitchStatus)\n    {\n        startTime = millis();\n        if (millis() - startTime &gt; 1000)\n        {\n            if (powerSwitchStatus == HIGH)\n            {\n                powerStatus = LOW;\n            }\n            else\n            {\n                powerStatus = HIGH;\n            }\n        }\n        lastPowerSwitchStatus = powerSwitchStatus;\n    }              \n\n    \/\/ LCD \u663e\u793a\u5904\u7406\n    lcd.clear();\n    lcd.setCursor(0, 0);\n    memset(lcdString, 0, sizeof(lcdString));\n    if (powerSwitchStatus)\n    {\n        sprintf(lcdString, &quot;Level: %d&quot;, analogRead(FAN_VOLTAGE_PIN));\n        if (digitalRead(HUMAN_BODY_PIN) == HIGH)\n        {\n            digitalWrite(ELECTRO_RELAY_PIN, HIGH);\n        }\n        else\n        {\n            digitalWrite(ELECTRO_RELAY_PIN, LOW);\n        }\n    }\n    else\n    {\n        sprintf(lcdString, &quot;Power off&quot;);\n        digitalWrite(ELECTRO_RELAY_PIN, LOW);\n    }\n    lcd.print(lcdString);\n    lcd.setCursor(0, 1);\n    memset(lcdString, 0, sizeof(lcdString));\n    sprintf(lcdString, &quot;Temperature: %dC&quot;, (int)temperatureC);\n    lcd.print(lcdString);\n}<\/code><\/pre>\n<p>\u5173\u95ed\u65f6<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679634604871.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 785px; --smush-placeholder-aspect-ratio: 785\/383;\" \/><\/p>\n<p>\u6309\u89e6\u6478\u6309\u94ae\u5f00\u542f\u540e<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679634649713.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 731px; --smush-placeholder-aspect-ratio: 731\/351;\" \/><\/p>\n<p>\u5f00\u542f\u4e14\u611f\u5e94\u5230\u4eba\u7684\u65f6\u5019\uff08\u7535\u4f4d\u5668\u7ed9\u5230\u6700\u5927\u65f6\uff09<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679634668219.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 729px; --smush-placeholder-aspect-ratio: 729\/338;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679634691514.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 255px; --smush-placeholder-aspect-ratio: 255\/288;\" \/><\/p>\n<p>\u7535\u4f4d\u5668\u8c03\u8282\u5230\u5176\u4ed6\u7535\u538b\u65f6<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/03\/image-1679634831154.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 709px; --smush-placeholder-aspect-ratio: 709\/330;\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u524d\u51e0\u5929\u505a\u4e86\u4e00\u4e2a\u673a\u5668\u4eba\u7efc\u5408\u521b\u65b0\u5b9e\u9a8c\uff0c\u8001\u5e08\u8ba9\u6211\u4eec\u8bbe\u8ba1\u4e00\u4e2a\u4e1c\u897f\uff0c\u7136\u540e\u505a\u4e00\u5b9a\u5b9e\u73b0\uff0c\u56e0\u4e3a\u548c\u6211\u4eec\u4e13\u4e1a\u5173\u7cfb\u4e0d\u662f\u5f88\u5927\uff0c\u6240 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"_lmt_disableupdate":"no","_lmt_disable":"no","footnotes":""},"categories":[1,594],"tags":[],"class_list":["post-9900","post","type-post","status-publish","format-standard","hentry","category-all","category-594"],"modified_by":"IYATT-yx","_links":{"self":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/9900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9900"}],"version-history":[{"count":0,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/9900\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}