{"id":2133,"date":"2018-05-19T13:44:17","date_gmt":"2018-05-19T05:44:17","guid":{"rendered":"https:\/\/drho.club\/?p=2133"},"modified":"2018-05-19T13:44:17","modified_gmt":"2018-05-19T05:44:17","slug":"arduino-7-segments-led","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2018\/05\/19\/arduino-7-segments-led\/","title":{"rendered":"\u3010Arduino\u3011\u5728Arduino\u4e2d\u76f4\u63a5\u9a45\u52d57\u6bb5\u986f\u793a\u5668"},"content":{"rendered":"<p>\u5728\u524d\u9762\u7684\u55ae\u5143\u5be6\u7fd2\u4e2d\u6211\u5011\u66fe\u7d93\u4ecb\u7d39\u904eLCD\u6db2\u6676\u986f\u793a\u5668\u7684\u64cd\u4f5c\u8207\u4f7f\u7528\u3002\u5b83\u53ef\u4ee5\u76f4\u63a5\u4ee5\u8f03\u9ad8\u968e\u7684\u65b9\u5f0f\u4f86\u8f38\u5165\u6587\u5b57\u5167\u5bb9\uff0c\u4e5f\u53ef\u4ee5\u540c\u6642\u8f38\u51fa2\u5217\u540416\u500b\u82f1\u6587\u5b57\u6bcd\u53ca\u6578\u5b57\uff0c\u975e\u5e38\u65b9\u4fbf\u3002\u4e0d\u904e\uff0c\u53ef\u60dc\u7684\u662f\u5b83\u7684\u4eae\u5ea6\u4e0d\u8db3\uff0c\u6709\u6642\u5019\u60f3\u8981\u8b93\u986f\u793a\u7684\u6587\u6578\u5b57\u53ef\u4ee5\u505a\u5f97\u9192\u76ee\u4e00\u9ede\u6642\u5c31\u6d3e\u4e0d\u4e0a\u7528\u5834\u3002\u5982\u679c\u5728\u53ea\u9700\u8981\u986f\u793a\u6578\u5b57\u7684\u5834\u5408\uff0c\u540c\u6642\u4e5f\u4e0d\u9700\u8981\u592a\u591a\u4f4d\u6578\u7684\u8a71\uff0c\u4e03\u6bb5\u986f\u793a\u5668\u6240\u800c\u662f\u6bd4\u8f03\u597d\u7684\u9078\u64c7\u3002<\/p>\n<p>\u4e03\u6bb5\u986f\u793a\u5668\u9867\u540d\u601d\u7fa9\u5c31\u662f\u4f7f\u75287\u500bLED\u7dda\u6bb5\uff0c\u7528\u4f86\u7d44\u5408\u51fa0\u52309\u7684\u6578\u5b57\uff0c\u6bcf\u4e00\u500b\u7dda\u6bb5\u578b\u7684LED\u90fd\u662f\u4e00\u500b\u7368\u7acb\u7684LED\u71c8\u865f\uff0c\u53ef\u4ee5\u900f\u904e\u63a5\u8173\u7684\u901a\u96fb\u8207\u5426\u6c7a\u5b9a\u5b83\u662f\u4eae\u9084\u662f\u6ec5\uff0c7\u500b\u7dda\u6bb5\u5c31\u67097\u500b\u500b\u5225\u7684\u63a5\u8173\u4f86\u52a0\u4ee5\u63a7\u5236\u3002\u80cc\u9762\u5982\u4e0b\uff1a<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.17.36.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2140\" src=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.17.36.jpg\" alt=\"\" width=\"400\" height=\"355\" \/><\/a><\/p>\n<p>\u9019\u4e9b\u63a5\u8173\u5c0d\u61c9\u5230\u6bcf\u4e00\u500bLED\u71c8\u865f\u7684\u8173\u4f4d\u5716\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/7segment.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2138 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/7segment.jpg\" alt=\"\" width=\"519\" height=\"481\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/7segment.jpg 800w, https:\/\/104.es\/wp-content\/uploads\/2018\/05\/7segment-300x278.jpg 300w, https:\/\/104.es\/wp-content\/uploads\/2018\/05\/7segment-768x712.jpg 768w, https:\/\/104.es\/wp-content\/uploads\/2018\/05\/7segment-600x557.jpg 600w\" sizes=\"auto, (max-width: 519px) 100vw, 519px\" \/><\/a><\/p>\n<p>\u4e2d\u9593\u7684\u5171\u63a5\u9ede\u4e0a\u4e0b\u90fd\u662f\u901a\u7684\uff0c\u5982\u679c\u662f\u5171\u967d\u6975\u76847\u6bb5\u986f\u793a\u5668\uff0c\u5247\u5176\u4e2d\u4e00\u500b\u5171\u63a5\u9ede\u5c31\u8981\u63a5\u4e0a\u6b63\u96fb\u6e90\uff0c\u5982\u679c\u662f\u5171\u9670\u6975\u7684\u8a71\uff0c\u5247\u662f\u5176\u4e2d\u4e00\u500b\u5171\u63a5\u9ede\u8981\u63a5\u4e0aGND\u8ca0\u6975\u3002\u5176\u5b83\u7684a~g\u7b49\u63a5\u8173\uff0c\u5247\u4f9d\u5e8f\u63a5\u5230Arduino\u677f\u5b50\u4e0a\u7684\u6578\u4f4d\u8f38\u51fa\u5165\u63a5\u8173\uff0c\u5728\u9019\u500b\u4f8b\u5b50\u4e2d\uff0c\u6211\u5011\u5f9eD2\u958b\u59cb\u63a5\uff0c\u5f9eD2\u63a5a\uff0cD3\u63a5b\uff0c\u4f9d\u6b64\u985e\u4f4d\uff0c\u63a5\u5b8c\u4e4b\u5f8c\uff0c\u5176\u9023\u63a5\u7dda\u5982\u4e0b\u5716\u6240\u793a\uff1a<\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.00.40.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2135 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.00.40.jpg\" alt=\"\" width=\"600\" height=\"450\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.00.40.jpg 600w, https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.00.40-300x225.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>\u56e0\u70ba\u5728\u9019\u500b\u4f8b\u5b50\u4e2d\u6211\u5011\u4f7f\u7528\u7684\u662f\u5171\u967d\u6975\u76847\u6bb5\u986f\u793a\u5668\uff0c\u56e0\u6b64\u6211\u5011\u628aArduino\u76845V\u6b63\u96fb\u6e90\u63a5\u5230\u9eb5\u5305\u677f\u4e0a\u7684\u6b63\u532f\u6d41\u6392\u4e4b\u5f8c\uff08\u5225\u5fd8\u4e86\u9eb5\u5305\u677f\u4e0a\u7684\u8ca0\u532f\u6d41\u6392\u8981\u63a5\u56deArduino\u677f\u5b50\u4e0a\u7684GND\uff0c\u8b93\u5b83\u5011\u53ef\u4ee5\u5f62\u6210\u56de\u8def\u5594\uff09\uff0c\u518d\u5f9e\u9eb5\u5305\u677f\u4e0a\u7684\u6b63\u532f\u6d41\u6392\u7528\u4e00\u500b\u9650\u6d41\u96fb\u963b\u9023\u63a5\u52307\u6bb5\u986f\u793a\u5668\u6b63\u4e0a\u65b9\u7684\u5171\u63a5\u9ede\u8655\uff0c\u5982\u4e0b\u5716\u6240\u793a\uff1a<\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.01.14.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2137 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.01.14.jpg\" alt=\"\" width=\"600\" height=\"450\" \/><\/a><\/p>\n<p>\u5982\u6b64\u96fb\u8def\u5c31\u7b97\u662f\u63a5\u597d\u4e86\uff0c\u4ee5\u4e0b\u662f\u5168\u9ad4\u770b\u8d77\u4f86\u7684\u6a23\u5b50\uff1a<\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.00.46.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2136 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.00.46.jpg\" alt=\"\" width=\"600\" height=\"450\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.00.46.jpg 600w, https:\/\/104.es\/wp-content\/uploads\/2018\/05\/2018-05-19-13.00.46-300x225.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>\u5c0d\u65bcArduino\u800c\u8a00\uff0cD2\u5230D8\u90fd\u8981\u8a2d\u5b9a\u70ba\u8f38\u51fa\u63a5\u8173\uff0c\u800c\u7576\u6b64\u63a5\u8173\u8f38\u51fa\u662fHIGH\uff081\uff09\u7684\u6642\u5019\uff0c\u8a72\u8f38\u51fa\u6240\u9023\u63a5\u5230\u7684LED\u71c8\u865f\u5c31\u4e0d\u6703\u4eae\uff08\u56e0\u70ba\u662f\u5171\u967d\u6975\uff0c\u6240\u4ee5\u8f38\u51fa\u662f1\u6642\u5c31\u4e0d\u6703\u4eae\uff0c\u800c\u8f38\u51fa\u662f0\u6642\u5c31\u6703\u4eae\uff0c\u5982\u679c\u662f\u5171\u9670\u6975\u7684\u8a71\u5c31\u76f8\u53cd\uff09\uff0c\u6211\u5011\u53ea\u8981\u9069\u7576\u5730\u63a7\u5236\u6bcf\u4e00\u652f\u8173\u8f38\u51fa\u7684\u5167\u5bb9\uff0c\u5c31\u53ef\u4ee5\u7d44\u5408\u51fa\u6b63\u78ba\u7684\u6578\u5b57\u3002\u70ba\u4e86\u7c21\u5316\u7a0b\u5f0f\u7684\u8f38\u51fa\u5167\u5bb9\uff0c\u5728\u9019\u88e1\u5148\u5b9a\u7fa9\u4e00\u500b\u7528\u4f86\u7d44\u5408\u51fa\u6b63\u78ba\u6578\u5b57\u7684\u8f38\u51fa\u6a23\u9663\u5217\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>[code]<br \/>\nint digits[10][7] = {<br \/>\n\/\/a, b, c, d, e, f, g<br \/>\n0, 0, 0, 0, 0, 0, 1, \/\/ 0<br \/>\n1, 0, 0, 1, 1, 1, 1, \/\/ 1<br \/>\n0, 0, 1, 0, 0, 1, 0, \/\/ 2<br \/>\n0, 0, 0, 0, 1, 1, 0, \/\/ 3<br \/>\n1, 0, 0, 1, 1, 0, 0, \/\/ 4<br \/>\n0, 1, 0, 0, 1, 0, 0, \/\/ 5<br \/>\n0, 1, 0, 0, 0, 0, 0, \/\/ 6<br \/>\n0, 0, 0, 1, 1, 1, 1, \/\/ 7<br \/>\n0, 0, 0, 0, 0, 0, 0, \/\/ 8<br \/>\n0, 0, 0, 0, 1, 0, 0 \/\/ 9<br \/>\n};<br \/>\n[\/code]<\/p>\n<p>\u6709\u4e86\u4ee5\u4e0a\u7684\u9663\u5217\uff0c\u5c31\u53ef\u4ee5\u900f\u904e\u4ee5\u4e0b\u9019\u500b show\u51fd\u6578\u7c21\u55ae\u4e5f\u986f\u793a\u51fa\u6240\u9700\u8981\u7684\u6578\u5b57\uff1a<\/p>\n<p>[code]<br \/>\nint show(int d) {<br \/>\n  for(int i=2; i&lt;9; i++) {<br \/>\n    digitalWrite(i, digits[d][i]);<br \/>\n  }<br \/>\n}<br \/>\n[\/code]<\/p>\n<p>\u5b8c\u6574\u7684\u5f9e0\u6578\u52309\u7684\u7a0b\u5f0f\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>[code]<br \/>\nint digits[10][7] = {<br \/>\n\/\/a, b, c, d, e, f, g<br \/>\n  0, 0, 0, 0, 0, 0, 1, \/\/ 0<br \/>\n  1, 0, 0, 1, 1, 1, 1, \/\/ 1<br \/>\n  0, 0, 1, 0, 0, 1, 0, \/\/ 2<br \/>\n  0, 0, 0, 0, 1, 1, 0, \/\/ 3<br \/>\n  1, 0, 0, 1, 1, 0, 0, \/\/ 4<br \/>\n  0, 1, 0, 0, 1, 0, 0, \/\/ 5<br \/>\n  0, 1, 0, 0, 0, 0, 0, \/\/ 6<br \/>\n  0, 0, 0, 1, 1, 1, 1, \/\/ 7<br \/>\n  0, 0, 0, 0, 0, 0, 0, \/\/ 8<br \/>\n  0, 0, 0, 0, 1, 0, 0  \/\/ 9<br \/>\n};<\/p>\n<p>void setup() {<br \/>\n  for(int i=2; i&lt;9; i++) {<br \/>\n    pinMode(i, OUTPUT);<br \/>\n    digitalWrite(i, LOW);<br \/>\n  }<br \/>\n}<\/p>\n<p>int show(int d) {<br \/>\n  for(int i=2; i&lt;9; i++) {<br \/>\n    digitalWrite(i, digits[d][i]);<br \/>\n  }<br \/>\n}<\/p>\n<p>void loop() {<br \/>\n  for(int i=0; i&lt;10; i++) {<br \/>\n    show(i);<br \/>\n    delay(500);<br \/>\n  }<br \/>\n}<\/p>\n<p>[\/code]<\/p>\n<p>\u4ee5\u4e0b\u662f\u7a0b\u5f0f\u57f7\u884c\u4e4b\u5f8c\u7684\u6a23\u5b50\uff1a<\/p>\n<p><iframe loading=\"lazy\" title=\"Arduino\u76f4\u63a5\u9a45\u52d57\u6bb5\u986f\u793a\u5668\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/TEjwoqSytQk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u524d\u9762\u7684\u55ae\u5143\u5be6\u7fd2\u4e2d\u6211\u5011\u66fe\u7d93\u4ecb\u7d39\u904eLCD\u6db2\u6676\u986f\u793a\u5668\u7684\u64cd\u4f5c\u8207\u4f7f\u7528\u3002\u5b83\u53ef\u4ee5\u76f4\u63a5\u4ee5\u8f03\u9ad8\u968e\u7684\u65b9\u5f0f\u4f86\u8f38\u5165\u6587\u5b57\u5167\u5bb9\uff0c\u4e5f\u53ef\u4ee5\u540c\u6642\u8f38\u51fa2\u5217\u540416\u500b\u82f1\u6587\u5b57\u6bcd\u53ca\u6578\u5b57\uff0c\u975e\u5e38\u65b9\u4fbf\u3002\u4e0d\u904e\uff0c\u53ef\u60dc\u7684\u662f\u5b83\u7684\u4eae\u5ea6\u4e0d\u8db3\uff0c\u6709\u6642\u5019\u60f3\u8981\u8b93\u986f\u793a\u7684\u6587\u6578\u5b57\u53ef\u4ee5\u505a\u5f97\u9192\u76ee\u4e00\u9ede\u6642\u5c31\u6d3e\u4e0d\u4e0a\u7528\u5834\u3002\u5982\u679c\u5728\u53ea\u9700\u8981\u986f\u793a\u6578\u5b57\u7684\u5834\u5408\uff0c\u540c\u6642\u4e5f\u4e0d\u9700\u8981\u592a\u591a\u4f4d\u6578\u7684\u8a71\uff0c\u4e03\u6bb5\u986f\u793a\u5668\u6240\u800c\u662f\u6bd4\u8f03\u597d\u7684\u9078\u64c7\u3002<\/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-2133","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\/2133","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=2133"}],"version-history":[{"count":0,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2133\/revisions"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=2133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=2133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=2133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}