{"id":2804,"date":"2018-05-31T16:37:28","date_gmt":"2018-05-31T08:37:28","guid":{"rendered":"https:\/\/drho.club\/?p=2227"},"modified":"2018-05-31T16:37:28","modified_gmt":"2018-05-31T08:37:28","slug":"arduino-ir-counter","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2018\/05\/31\/arduino-ir-counter\/","title":{"rendered":"\u3010Arduino\u3011\u8207\u7d05\u5916\u7dda\u8a08\u6578\u5668\u5be6\u4f5c"},"content":{"rendered":"<p>\u540c\u6a23\u662f\u7d05\u5916\u7dda\u7684\u61c9\u7528\uff0c\u524d\u4e00\u500b\u63a5\u6536\u5668\u5728\u61c9\u7528\u7684\u6642\u5019\u662f\u8003\u616e\u5230\u63a5\u6536\u7684\u5167\u5bb9\uff0c\u4e5f\u5c31\u662f\u4e0d\u540c\u7684\u6309\u9215\u8981\u6709\u4e0d\u540c\u7684\u5b57\u4e32\uff0c\u4ee5\u8fa8\u8b58\u51fa\u5230\u5e95\u662f\u54ea\u4e00\u500b\u6309\u9215\u88ab\u6309\u4e0b\u53bb\uff0c\u7136\u5f8c\u624d\u53ef\u4ee5\u6839\u64da\u4e0d\u540c\u7684\u6309\u9215\u505a\u51fa\u4e0d\u540c\u7684\u56de\u61c9\uff0c\u4ee5\u9054\u5230\u7d05\u5916\u7dda\u9059\u63a7\u7684\u529f\u80fd\u3002\u7136\u800c\uff0c\u7d05\u5916\u7dda\u7684\u53e6\u5916\u4e00\u500b\u61c9\u7528\u5247\u4e0d\u662f\u7528\u4f86\u63a7\u5236\uff0c\u53ea\u8981\u55ae\u7d14\u60f3\u8981\u7528\u4f86\u6aa2\u6e2c\u524d\u9762\u6709\u6c92\u6709\u6771\u897f\uff0c\u6216\u662f\u7528\u4f86\u5c0d\u65bc\u524d\u9762\u7d93\u904e\u7684\u4e8b\u7269\u505a\u4e00\u500b\u7c21\u55ae\u7684\u8a08\u6b21\u529f\u80fd\uff0c\u6b64\u6642\u8981\u4f7f\u7528\u7684\u5c31\u662f\u5305\u62ec\u767c\u5c04\u4ee5\u53ca\u63a5\u6536\u7d05\u5916\u7dda\u7684\u6210\u5c0d\u7684\u6a21\u7d44\uff0c\u7531\u65bc\u5b83\u5011\u7d93\u5e38\u88ab\u62ff\u4f86\u505a\u70ba\u81ea\u8d70\u8eca\u7684\u907f\u969c\u6a5f\u5236\uff0c\u56e0\u6b64\u5e38\u88ab\u7a31\u70ba\u907f\u969c\u6a21\u7d44\u3002\u4ee5\u4e0b\u5c31\u662f\u6211\u5011\u9019\u6b21\u5be6\u7fd2\u7684\u5c0d\u8c61\uff1a<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-31-16.24.52.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2228\" src=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-31-16.24.52.jpg\" alt=\"\" width=\"400\" height=\"156\" \/><\/a><\/p>\n<p>\u9019\u500b\u6a21\u7d44\u5df2\u7d93\u628a\u6240\u6709\u7684\u4e8b\u60c5\u505a\u5230\u975e\u5e38\u7c21\u55ae\u4e86\uff0c\u5b83\u63d0\u4f9b\u4e864\u652f\u63a5\u8173\uff0c\u5206\u5225\u90fd\u6709\u6a19\u793a\u6587\u5b57\u5728\u4e0a\u9762\u3002\u53e6\u5916\u6709\u5169\u500b\u65cb\u9215\u5247\u5206\u5225\u53ef\u4ee5\u8abf\u6574\u5176\u9748\u654f\u5ea6\u3002\u5982\u4e0a\u5716\u6700\u4e0b\u65b9\u7684GND\u5c31\u662f\u63a5\u5230Arduino\u7684GND\uff0c\u5b83\u65c1\u908a\u7684\u90a3\u652f\u63a5\u8173\u6a19\u793a\u8457\u300c+\u300d\u5c31\u662f\u8981\u63a5\u52305V\u7684\u96fb\u6e90\uff0c\u300c+\u300d\u4e0a\u9762\u90a3\u652f\u5c31\u662f\u4fe1\u865f\u8f38\u51fa\u63a5\u8173\uff0c\u6700\u5f8c\u4e00\u652f\u8173\u5247\u4e0d\u9700\u8981\u9023\u63a5\u4f7f\u7528\u3002\u7531\u65bc\u5b83\u6703\u91dd\u5c0d\u524d\u65b9\u662f\u5426\u6709\u969c\u7919\u7269\u6c7a\u5b9a\u8981\u8f38\u51faHIGH\u6216\u662fLOW\uff0c\u662f\u5c6c\u65bc\u6578\u4f4d\u7684\u4fe1\u865f\uff0c\u6240\u4ee5\u628a\u5b83\u9023\u63a5\u5230GPIO\u7684\u4efb\u4f55\u4e00\u652f\u63a5\u8173\u90fd\u53ef\u4ee5\u3002\u5728\u6b64\u4f8b\uff0c\u6211\u5011\u628a\u5b83\u9023\u63a5\u5230\u7b2c9\u652f\u8173\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-31-16.25.06.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2229 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-31-16.25.06.jpg\" alt=\"\" width=\"692\" height=\"489\" \/><\/a><\/p>\n<p>\u672c\u6a21\u7d44\u7684\u7a0b\u5f0f\u975e\u5e38\u7c21\u55ae\uff0c\u53ea\u8981\u8b80\u53d6\u7b2c9\u652f\u8173\u7684\u96fb\u4f4d\u5c31\u53ef\u4ee5\u958b\u59cb\u8a08\u7b97\u5728\u7d05\u5916\u7dda\u524d\u9762\u7269\u9ad4\u7684\u7d93\u904e\u6b21\u6578\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>[code]<br \/>\nint count=0;<br \/>\nvoid setup() {<br \/>\n Serial.begin (9600);<br \/>\n pinMode (9, INPUT);<br \/>\n}<\/p>\n<p>void loop() {<br \/>\n Serial.print (&quot;Count: &quot;);<br \/>\n if (!digitalRead(9)) {<br \/>\n  count++;<br \/>\n }<br \/>\n Serial.println (count);<br \/>\n delay (100);<br \/>\n}<br \/>\n[\/code]<\/p>\n<p>\u9019\u500b\u7a0b\u5f0f\u4ee5\u6bcf0.1\u79d2\u7684\u901f\u5ea6\u4f86\u8a08\u7b97\u524d\u9762\u7269\u9ad4\u51fa\u73fe\u7684\u6b21\u6578\uff0c\u5982\u679c\u7269\u9ad4\u4e00\u76f4\u505c\u7559\u5728\u90a3\u88e1\u7684\u8a71\u6703\u4e00\u76f4\u4e0d\u65b7\u5730\u8a08\u6578\uff0c\u56e0\u6b64\u5982\u679c\u9700\u8981\u505a\u4e00\u500b\u597d\u7684\u8a08\u6578\u5668\uff0c\u9700\u8981\u518d\u591a\u52a0\u4e00\u4e9b\u689d\u4ef6\u4e0a\u7684\u5224\u65b7\u624d\u884c\u3002\u7a0b\u5f0f\u7684\u57f7\u884c\u7d50\u679c\u5982\u4ee5\u4e0b\u7684\u76e3\u63a7\u8996\u7a97\u6240\u770b\u5230\u7684\u6a23\u5b50\uff1a<\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-31_16-36-17.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2230 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-31_16-36-17.png\" alt=\"\" width=\"689\" height=\"548\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u6a23\u662f\u7d05\u5916\u7dda\u7684\u61c9\u7528\uff0c\u524d\u4e00\u500b\u63a5\u6536\u5668\u5728\u61c9\u7528\u7684\u6642\u5019\u662f\u8003\u616e\u5230\u63a5\u6536\u7684\u5167\u5bb9\uff0c\u4e5f\u5c31\u662f\u4e0d\u540c\u7684\u6309\u9215\u8981\u6709\u4e0d\u540c\u7684\u5b57\u4e32\uff0c\u4ee5\u8fa8\u8b58\u51fa\u5230\u5e95\u662f\u54ea\u4e00\u500b\u6309\u9215\u88ab\u6309\u4e0b\u53bb\uff0c\u7136\u5f8c\u624d\u53ef\u4ee5\u6839\u64da\u4e0d\u540c\u7684\u6309\u9215\u505a\u51fa\u4e0d\u540c\u7684\u56de\u61c9\uff0c\u4ee5\u9054\u5230\u7d05\u5916\u7dda\u9059\u63a7\u7684\u529f\u80fd\u3002\u7136\u800c\uff0c\u7d05\u5916\u7dda\u7684\u53e6\u5916\u4e00\u500b\u61c9\u7528\u5247\u4e0d\u662f\u7528\u4f86\u63a7\u5236\uff0c\u53ea\u8981\u55ae\u7d14\u60f3\u8981\u7528\u4f86\u6aa2\u6e2c\u524d\u9762\u6709\u6c92\u6709\u6771\u897f\uff0c\u6216\u662f\u7528\u4f86\u5c0d\u65bc\u524d\u9762\u7d93\u904e\u7684\u4e8b\u7269\u505a\u4e00\u500b\u7c21\u55ae\u7684\u8a08\u6b21\u529f\u80fd\uff0c\u6b64\u6642\u8981\u4f7f\u7528\u7684\u5c31\u662f\u5305\u62ec\u767c\u5c04\u4ee5\u53ca\u63a5\u6536\u7d05\u5916\u7dda\u7684\u6210\u5c0d\u7684\u6a21\u7d44\uff0c\u7531\u65bc\u5b83\u5011\u7d93\u5e38\u88ab\u62ff\u4f86\u505a\u70ba\u81ea\u8d70\u8eca\u7684\u907f\u969c\u6a5f\u5236\uff0c\u56e0\u6b64\u5e38\u88ab\u7a31\u70ba\u907f\u969c\u6a21\u7d44<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-2804","post","type-post","status-publish","format-standard","hentry","category-arduino"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/comments?post=2804"}],"version-history":[{"count":0,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2804\/revisions"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=2804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=2804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=2804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}