{"id":2793,"date":"2017-12-25T07:31:30","date_gmt":"2017-12-24T23:31:30","guid":{"rendered":"https:\/\/drho.club\/?p=1866"},"modified":"2017-12-25T07:31:30","modified_gmt":"2017-12-24T23:31:30","slug":"arduino-unit-11","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2017\/12\/25\/arduino-unit-11\/","title":{"rendered":"[Arduino\u521d\u968e\u5be6\u7fd2] Unit 11\uff1aLCD\u9ede\u9663\u6db2\u6676\u986f\u793a\u5668\u6a21\u7d44\u64cd\u4f5c\u5be6\u7fd2"},"content":{"rendered":"<p>\u4e4b\u524d\u7684\u5be6\u7fd2\u6211\u5011\u90fd\u662f\u900f\u9047\u71c8\u865f\u4f86\u77ad\u89e3Arduino\u7684\u8f38\u51fa\uff0c\u6216\u662f\u900f\u904e\u76e3\u63a7\u8996\u7a97\u4f86\u89c0\u5bdf\u7a0b\u5f0f\u8b8a\u6578\u503c\u7684\u8b8a\u5316\uff0c\u5176\u5be6\uff0cArduino\u4e5f\u6709\u8a31\u591a\u7684\u8f38\u51fa\u6a21\u7d44\u53ef\u4ee5\u5229\u7528\u6587\u5b57\u4f86\u9032\u884c\u8f38\u51fa\uff0c\u800c\u5176\u4e2d\u50f9\u683c\u6700\u4fbf\u5b9c\u53c8\u64cd\u4f5c\u7c21\u55ae\u7684\u5c31\u662fLCD\u6db2\u6676\u6a21\u7d44\uff0c\u73fe\u5728\u7684\u6a21\u7d44\u5927\u90fd\u5df2\u7d93\u4f7f\u7528LCM 1602\u9019\u500b\u9846IC\u8b93\u6a21\u7d44\u53ef\u4ee5\u900f\u904eI2C\u7684\u65b9\u5f0f\uff0c\u53ea\u8981\u4f7f\u75282\u689d\u7dda\u5c31\u53ef\u4ee5\u548cArduino\u9032\u884c\u901a\u8a0a\uff0c\u975e\u5e38\u65b9\u4fbf\u3002\u9019\u500b\u55ae\u5143\u5c31\u8b93\u6211\u5011\u4f86\u770b\u770b\u5982\u4f55\u53ef\u4ee5\u8f15\u6613\u5730\u548c\u53ef\u4ee5\u986f\u793a2\u884c\u82f1\u6587\u5b57\uff0c\u6bcf\u4e00\u884c\u53ef\u4ee5\u652f\u63f416\u500b\u5b57\u5143\uff0816&#215;2\uff09\u7684\u6db2\u6676\u986f\u793a\u5668\u5427\uff01<\/p>\n<p>\u4ee5\u4e0b\u662f\u9019\u500bLCD\u6a21\u7d44\u7684\u6b63\u53cd\u9762\u7167\u7247\uff1a<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-06.24.04.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1867\" src=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-06.24.04.jpg\" alt=\"\" width=\"800\" height=\"450\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-06.24.04.jpg 800w, https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-06.24.04-300x169.jpg 300w, https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-06.24.04-768x432.jpg 768w, https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-06.24.04-600x338.jpg 600w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-06.24.18.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1868 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-06.24.18.jpg\" alt=\"\" width=\"800\" height=\"450\" \/><\/a><\/p>\n<p>\u5728\u80cc\u9762\u7167\u7247\u4e0a\u53ef\u4ee5\u770b\u5230\u9019\u500b\u6a21\u7d44\u53ea\u67094\u652f\u63a5\u8173\uff0c\u5176\u4e2d2\u652f\uff08\u4e0a\u65b9\uff09\u5206\u5225\u662fGND\u548cVCC\uff08\u9023\u63a5\u5230Arduino\u76845V\uff09\uff0c\u7136\u5f8c\u63a5\u8457\u662fSDA\u4ee5\u53caSCL\uff0c\u9019\u5169\u500b\u63a5\u8173\u4e0d\u7528\u60f3\u592a\u591a\uff0c\u5c31\u662fI2C\u901a\u8a0a\u5354\u5b9a\u4f7f\u7528\u7684\u63a5\u8173\uff0c\u800c\u4e14\uff0c\u5728Arduino\u4e0a\u5c31\u6709\u5169\u652f\u76f8\u5c0d\u61c9\u7684\u63a5\u8173\u5c31\u662f\u7d66I2C\u901a\u8a0a\u5354\u5b9a\u4f7f\u7528\u7684\uff0c\u5206\u5225\u662fA4\u4ee5\u53caA5\uff0c\u6240\u4ee5\uff0c\u610f\u601d\u662f\u8aaa\uff0c\u53ea\u8981\u5f88\u7c21\u55ae\u5730\u628aSDA\u63a5\u5230A4\uff0c\u800cSCL\u63a5\u5230A5\uff0c\u5c31\u5b8c\u6210\u96fb\u8def\u7684\u9023\u63a5\u4e86\uff01<\/p>\n<p>\u81f3\u65bc\u4ec0\u9ebc\u662fI2C\uff0c\u8acb\u611f\u8208\u8da3\u7684\u540c\u5b78\u5011\u81ea\u884c\u524d\u5f80Google\u53bb\u641c\u5c0b\u76f8\u95dc\u8cc7\u6599\u3002\u5728Arduino\u548cLCD\u7684\u9023\u63a5\u4f7f\u7528\u4e0a\uff0c\u5df2\u7d93\u6709\u4eba\u5e6b\u6211\u5011\u5beb\u597d\u7a0b\u5f0f\u5eab\u6a21\u7d44\uff0c\u6211\u5011\u53ea\u8981\u4e0b\u8f09\u62ff\u4f86\u4f7f\u7528\u5373\u53ef\u3002\u7db2\u5740\uff1a<a href=\"https:\/\/bitbucket.org\/fmalpartida\/new-liquidcrystal\/downloads\/\" target=\"_blank\" rel=\"noopener\">https:\/\/bitbucket.org\/fmalpartida\/new-liquidcrystal\/downloads\/<\/a>\uff0c\u524d\u5f80\u6b64\u7db2\u5740\u4e4b\u5f8c\uff0c\u756b\u9762\u5982\u4e0b\uff1a<\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_06-59-02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1870 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_06-59-02.png\" alt=\"\" width=\"786\" height=\"484\" \/><\/a><\/p>\n<p>\u8acb\u5982\u7bad\u982d\u6240\u793a\u4e0b\u8f09\u6700\u65b0\u7248\u672c\u5230\u81ea\u5df1\u7684\u786c\u789f\u4e2d\uff0c\u7136\u5f8c\u89e3\u58d3\u7e2e\u4e4b\u5f8c\u8907\u88fd\u5b83\u7684\u8cc7\u6599\u593e\u5230Arduino\u7684Libraries\u7684\u8cc7\u6599\u593e\u4e0b\uff0c\u5982\u4e0b\u5716\u6240\u793a\uff1a<\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_07-01-13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1871 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_07-01-13.png\" alt=\"\" width=\"747\" height=\"513\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_07-01-13.png 981w, https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_07-01-13-300x206.png 300w, https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_07-01-13-768x528.png 768w, https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_07-01-13-600x412.png 600w\" sizes=\"auto, (max-width: 747px) 100vw, 747px\" \/><\/a><\/p>\n<p>\u63a5\u8457\u5c31\u53ef\u4ee5\u958b\u59cb\u8a2d\u8a08\u7a0b\u5f0f\u4e86\uff0c\u6211\u5011\u7684\u7b2c\u4e00\u500b\u6e2c\u8a66\u7684\u7a0b\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p>https:\/\/gist.github.com\/skynettw\/9bc0cc259d43e7efb2e65ef9df4d8da6<\/p>\n<p>\u5728\u4f7f\u7528\u7a0b\u5f0f\u5eab\u6700\u91cd\u8981\u7684\u5c31\u662f\u672c\u7a0b\u5f0f\u7684\u524d3\u884c\uff0c\u524d2\u884c\u5f15\u5165\u6240\u9700\u8981\u7684\u81ea\u8a02\u51fd\u5f0f\u6a19\u982d\u6a94\uff0c\u800c\u7b2c3\u884c\u5247\u662f\u8a2d\u5b9aLCD\u6db2\u6676\u986f\u793a\u6a21\u7d44\u7684\u4f4d\u5740\uff0c\u53ea\u8981\u76f4\u63a5\u8907\u88fd\u4f7f\u7528\u5373\u53ef\u3002\u5728\u7d93\u904e\u7b2c3\u884c\u7684\u8a2d\u5b9a\u4e4b\u5f8c\uff0c\u5c31\u53ef\u4ee5\u76f4\u63a5\u5728\u5f8c\u7e8c\u7684\u7a0b\u5f0f\u78bc\u4e2d\u4ee5lcd\u9019\u500b\u57f7\u884c\u5be6\u4f8b\u64cd\u4f5c\u9019\u500b\u6db2\u6676\u986f\u793a\u5668\u3002\u5e7e\u500b\u6bd4\u8f03\u91cd\u8981\u7684\u51fd\u5f0f\u5206\u5225\u662flcd.backlight()\u7528\u4f86\u958b\u555f\u80cc\u5149\uff0clcd.noBacklight()\u662f\u95dc\u9589\u80cc\u5149\uff0clcd.setCursor()\u7528\u4f86\u8a2d\u5b9a\u8981\u986f\u793a\u7684\u5b57\u5143\u7684\u8d77\u59cb\u4f4d\u7f6e\uff0c\u7b2c1\u500b\u6578\u5b57\u662f\u7b2c\u5e7e\u884c\uff0c\u800c\u7b2c2\u500b\u6578\u5b57\u662f\u7b2c\u5e7e\u5217\uff0c\u800clcd.print()\u5373\u662f\u8f38\u51fa\u5b57\u4e32\u7684\u5167\u5bb9\u3002\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u8f38\u51fa\u7684\u4e00\u884c\u6587\u5b57\u7684\u6642\u5019\u5b83\u4e26\u4e0d\u6703\u81ea\u884c\u5e6b\u6211\u5011\u6e05\u9664\u8a72\u884c\uff0c\u56e0\u6b64\u5728\u7a0b\u5f0f\u4f8b\u5b50\u4e2d\u4e00\u5f8b\u90fd\u8f38\u51fa\u525b\u597d16\u500b\u5b57\u5143\uff0c\u4ee5\u4fbf\u628a\u4e4b\u524d\u7684\u6587\u5b57\u5168\u90e8\u8986\u84cb\u6389\u3002\u4e0d\u904e\uff0c\u5982\u679c\u6253\u7b97\u6e05\u9664\u5168\u90e8\u7684\u6587\u5b57\u7684\u8a71\uff0c\u4f7f\u7528lcd.clear()\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u4e0a\u8ff0\u7a0b\u5f0f\u7684\u57f7\u884c\u7d50\u679c\u5982\u4e0b\u9762\u7684\u793a\u7bc4\u5f71\u7247\uff1a<\/p>\n<p><iframe loading=\"lazy\" title=\"16x2\u6db2\u6676\u986f\u793a\u6a21\u7d44\u64cd\u4f5c\u793a\u7bc4\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/7Ft-GZwmrcU?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<p>\u63a5\u4e0b\u4f86\u6211\u5011\u8981\u904b\u7528\u4e00\u500b\u6280\u5de7\uff0c\u8b93\u6211\u5011\u53ef\u4ee5\u628a\u5728\u5e8f\u5217\u57e0\u76e3\u63a7\u8996\u7a97\u8f38\u5165\u7684\u6587\u5b57\u8f49\u5230\u6b64\u6db2\u6676\u986f\u793a\u5668\u4e0a\u8f38\u51fa\u3002\u7a0b\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p>https:\/\/gist.github.com\/skynettw\/3e96b0e3c29597d90a160cb317f049c9<\/p>\n<p>\u6b64\u7a0b\u5f0f\u6703\u8b93Arduino\u4e00\u958b\u59cb\u5148\u986f\u793a\u5169\u500b\u6b61\u8fce\u8a0a\u606f\uff0c\u63a5\u8457\u5c31\u9032\u5165\u7b49\u5f85\u8ff4\u5708\u3002\u90a3\u500bSerial.available()\u662f\u7528\u4f86\u5075\u6e2c\u662f\u5426\u6709\u4f86\u81ea\u65bc\u5e8f\u5217\u57e0\u7684\u8f38\u5165\uff0c\u5982\u679c\u6709\u7684\u8a71\uff0c\u5c31\u6703\u5148\u7b49\u4e00\u5c0f\u9663\u6642\u9593\uff0c\u7136\u5f8c\u6e05\u9664\u756b\u9762\uff0c\u518d\u4f7f\u7528\u4e00\u500bwhile\u8ff4\u5708\uff0c\u900f\u904elcd.write()\u628a\u6240\u6709\u6536\u5230\u7684\u8cc7\u6599\u5168\u90e8\u8f38\u51fa\uff08Serial.read()\u662f\u7528\u4f86\u8b80\u53d6\u4f86\u81ea\u65bc\u5e8f\u5217\u57e0\u8cc7\u6599\u7528\u7684\uff09\u5230\u6db2\u6676\u986f\u793a\u5668\u4e0a\u3002\u5728\u7a0b\u5f0f\u57f7\u884c\u4e4b\u5f8c\uff0c\u540c\u5b78\u5011\u53ef\u4ee5\u958b\u555fArduino iDE\u4e0a\u7684\u5e8f\u5217\u57e0\u76e3\u63a7\u8996\u7a97\uff0c\u7136\u5f8c\u5728\u4e0a\u65b9\u8f38\u5165\u4e00\u6bb5\u6587\u5b57\u518d\u6309\u4e0bEnter\u6309\u9375\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u8a72\u6bb5\u8f38\u5165\u7684\u6587\u5b57\u88ab\u986f\u793a\u5728LCD\u4e0a\u4e86\u3002<\/p>\n<p><a href=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_07-25-02.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-1873 aligncenter\" src=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25_07-25-02.png\" alt=\"\" width=\"500\" height=\"447\" \/><\/a><\/p>\n<p>\u4ee5\u4e0b\u662f\u8f38\u51fa\u7684\u756b\u9762\uff1a<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-07.29.53.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1874\" src=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-07.29.53.jpg\" alt=\"\" width=\"800\" height=\"450\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-07.29.53.jpg 800w, https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-07.29.53-300x169.jpg 300w, https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-07.29.53-768x432.jpg 768w, https:\/\/104.es\/wp-content\/uploads\/2017\/12\/2017-12-25-07.29.53-600x338.jpg 600w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u7684\u5be6\u7fd2\u6211\u5011\u90fd\u662f\u900f\u9047\u71c8\u865f\u4f86\u77ad\u89e3Arduino\u7684\u8f38\u51fa\uff0c\u6216\u662f\u900f\u904e\u76e3\u63a7\u8996\u7a97\u4f86\u89c0\u5bdf\u7a0b\u5f0f\u8b8a\u6578\u503c\u7684\u8b8a\u5316\uff0c\u5176\u5be6\uff0cArduino\u4e5f\u6709\u8a31\u591a\u7684\u8f38\u51fa\u6a21\u7d44\u53ef\u4ee5\u5229\u7528\u6587\u5b57\u4f86\u9032\u884c\u8f38\u51fa\uff0c\u800c\u5176\u4e2d\u50f9\u683c\u6700\u4fbf\u5b9c\u53c8\u64cd\u4f5c\u7c21\u55ae\u7684\u5c31\u662fLCD\u6db2\u6676\u6a21\u7d44\uff0c\u73fe\u5728\u7684\u6a21\u7d44\u5927\u90fd\u5df2\u7d93\u4f7f\u7528LCM 1602\u9019\u500b\u9846IC\u8b93\u6a21\u7d44\u53ef\u4ee5\u900f\u904eI2C\u7684\u65b9\u5f0f\uff0c\u53ea\u8981\u4f7f\u75282\u689d\u7dda\u5c31\u53ef\u4ee5\u548cArduino\u9032\u884c\u901a\u8a0a\uff0c\u975e\u5e38\u65b9\u4fbf\u3002\u9019\u500b\u55ae\u5143\u5c31\u8b93\u6211\u5011\u4f86\u770b\u770b\u5982\u4f55\u53ef\u4ee5\u8f15\u6613\u5730\u548c\u53ef\u4ee5\u986f\u793a2\u884c\u82f1\u6587\u5b57\uff0c\u6bcf\u4e00\u884c\u53ef\u4ee5\u652f\u63f416\u500b\u5b57\u5143\uff0816&#215;2\uff09\u7684\u6db2\u6676\u986f\u793a\u5668\u5427\uff01<\/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-2793","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\/2793","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=2793"}],"version-history":[{"count":0,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2793\/revisions"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=2793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=2793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=2793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}