{"id":1816,"date":"2017-12-24T14:17:35","date_gmt":"2017-12-24T06:17:35","guid":{"rendered":"https:\/\/drho.club\/?p=1816"},"modified":"2017-12-24T14:17:35","modified_gmt":"2017-12-24T06:17:35","slug":"arduino-unit-4","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2017\/12\/24\/arduino-unit-4\/","title":{"rendered":"[Arduino\u521d\u968e\u5be6\u7fd2] Unit 4\uff1aRGB 3\u8272LED\u5be6\u7fd2&#8211;PWM\u8f38\u51fa"},"content":{"rendered":"<p>\u5728\u524d\u4e00\u500b\u55ae\u5143\u4e2d\u6211\u5011\u4f7f\u7528\u7684\u662f\u6578\u4f4d\u8f38\u51fa\u5165\u7684\u63a5\u8173\uff0c\u6b64\u7a2e\u63a5\u8173\u9867\u540d\u601d\u7fa9\uff0c\u8f38\u51fa\u503c\u53ea\u6709HIGH\u548cLOW\u5169\u7a2e\uff0c\u56e0\u6b64\u5728\u4e0a\u4e00\u500b\u4f8b\u5b50\u4e2d\uff0c\u5176\u4e2d\u7e3d\u5171\u53ea\u80fd\u8abf\u51fa8\u7a2e\u984f\u8272\u800c\u5df2\uff08\u540c\u5b78\u5011\u53ef\u4ee5\u601d\u8003\u4e00\u4e0b\u70ba\u4ec0\u9ebc\u662f8\u7a2e\u984f\u8272\u5594\uff09\u3002\u5728\u9019\u500b\u55ae\u5143\u4e2d\uff0c\u6211\u5011\u628a\u539f\u672c\u63a5\u5230\u6578\u4f4d\u63a5\u81732\u30013\u30014\u7684\u90a3\u4e09\u689d\u7dda\u6539\u63a5\u52303\u30015\u3001\u4ee5\u53ca6\uff0c\u5982\u679c\u4f60\u6709\u6ce8\u610f\u5230\u7684\u8a71\u6703\u767c\u73fe\uff0c\u90193\u500b\u63a5\u8173\u7684\u6578\u5b57\u65c1\u908a\uff0c\u6709\u4e00\u500b\u6ce2\u6d6a\u7684\u7b26\u865f\u300c~\u300d\uff0c\u9019\u5c31\u662f\u652f\u63f4PWM\u7684\u8f38\u51fa\u63a5\u8173\u3002<\/p>\n<p>\u56e0\u70ba\u53ea\u6709\u9023\u63a5\u5230Arduino\u7684\u7dda\u4f4d\u7f6e\u6709\u8b8a\u5316\uff0c\u5728\u9019\u88e1\u6211\u5011\u5c31\u4e0d\u518d\u7e6a\u51fa\u96fb\u8def\u5716\u4e86\uff0c\u76f4\u63a5\u4f86\u770b\u770b\u5982\u4f55\u4f7f\u7528\u9019\u4e9bPWM\u63a5\u8173\u3002\u7531\u65bc\u4f7f\u7528\u7684\u662f\u985e\u6bd4\u8f38\u51fa\u5165\u7684\u90e8\u4efd \uff0c\u56e0\u6b64\u5728\u7a0b\u5f0f\u4e2d\u6703\u6709\u5e7e\u500b\u8b8a\u5316\u3002\u9996\u5148\uff0c\u8981\u8a2d\u5b9a\u6578\u503c\u7684\u51fd\u6578\uff0c\u7531digitalWrite\u6539\u70baanalogWrite\uff0c\u5176\u6b21\uff0c\u8f38\u51fa\u7684\u503c\u7531\u539f\u672c\u7684HIGH\u4ee5\u53caLOW\u5169\u7a2e\uff0c\u6539\u70ba\u53ef\u4ee5\u5f9e0\u5230255\u7684\u6578\u5b57\uff0c\u7c21\u55ae\u5730\u770bPWM\uff0c\u4e0d\u540c\u6578\u503c\u8868\u793a\u8f38\u51fa\u4e0d\u540c\u7684\u96fb\u58d3\uff0c\u56e0\u70ba\u5f97\u5230\u7684\u96fb\u58d3\u503c\u4e0d\u540c\uff0cLED\u7684\u4eae\u5ea6\u5c31\u6703\u8ddf\u8457\u6709\u4e0d\u540c\u3002\u5148\u4f86\u770b\u770b\u5176\u4e2d\u4e00\u500b\u986f\u793a\u4e0d\u540c\u4eae\u5ea6\u7684\u7d05\u8272\u4e4b\u7a0b\u5f0f\u4f8b\uff1a<\/p>\n<p>https:\/\/gist.github.com\/skynettw\/6463ebc70bde778be9a2b673f5c98a9b<\/p>\n<p>\u9019\u500b\u7a0b\u5f0f\u4f7f\u7528\u4e86\u4e4b\u524d\u6c92\u6709\u898b\u904e\u7684\u8ff4\u5708\uff0c\u8ff4\u5708\u7684\u76ee\u7684\u5728\u65bc\u8b93\u67d0\u4e9b\u6558\u8ff0\u53ef\u4ee5\u91cd\u8986\u57f7\u884c\uff0c\u540c\u6642\u5728\u91cd\u8986\u7684\u904e\u7a0b\u4e2d\u8a2d\u5b9a\u4e00\u500b\u96a8\u8457\u8ff4\u5708\u57f7\u884c\u6b21\u6578\u800c\u8b8a\u5316\u7684\u7d22\u5f15\u8b8a\u6578\uff08\u5728\u6b64\u4f8b\u4e2d\u70ba\u8b8a\u6578i\uff09\uff0c\u900f\u904e\u6307\u5b9a i \u7684\u8d77\u59cb\u503c\u548c\u7d50\u675f\u503c\u4ee5\u53ca\u8b8a\u5316\u91cf\u4f86\u6c7a\u5b9a\u91cd\u8986\u7684\u6b21\u6578\uff0c\u4e26\u53ef\u4ee5\u5229\u7528\u6bcf\u6b21\u90fd\u6703\u6539\u8b8a\u7684\u8b8a\u6578 i \u7684\u6578\u503c\uff0c\u61c9\u7528\u65bc\u8f38\u51fa\u91cf\u7684\u5927\u5c0f\u3002\u4ee5\u4e0b\u662f\u4e0a\u8ff0\u7a0b\u5f0f\u7684\u57f7\u884c\u5be6\u4f8b\u5f71\u7247\uff1a<\/p>\n<p><iframe loading=\"lazy\" title=\"RGB LED\u7684\u985e\u6bd4\u8f38\u51fa\u986f\u793a\u7bc4\u4f8b\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/vc0Ij2uk_cA?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>\u5ef6\u7e8c\u4e0a\u9762\u7684\u4f8b\u5b50\uff0c\u53ef\u4ee5\u4fee\u6539\u4e0a\u4e00\u55ae\u5143\u7684\u8f38\u51fa\u51fd\u6578turn\uff0c\u4f7f\u5176\u53ef\u4ee5\u652f\u63f4\u985e\u6bd4\u7684\u8f38\u51fa\u5de5\u4f5c\u3002\u4ee5\u4e0b\u7684\u7a0b\u5f0f\u540c\u6642\u8b8a\u53163\u500b\u984f\u8272\uff0c\u7531\u65bc\u662f\u540c\u6b65\u8b8a\u5316\u76f8\u540c\u7684\u6578\u503c\uff0c\u6240\u4ee5\u57fa\u672c\u4e0a\u5c31\u662f\u767d\u8272\u5149\u7684\u7531\u660e\u8f49\u6697\u518d\u8f49\u660e\uff1a<\/p>\n<p>https:\/\/gist.github.com\/skynettw\/e7724d5f22624044d7110dd45eba3e00<\/p>\n<p>\u4ee5\u4e0b\u7684\u7a0b\u5f0f\u5247\u662f\u5229\u7528\u4e82\u6578\u51fd\u6578radnom\u88fd\u9020\u51fa\u96a8\u610f\u6539\u8b8a\u8272\u7684LED\u6548\u679c\uff1a<\/p>\n<p>https:\/\/gist.github.com\/skynettw\/53a2f9f69c221a77a92e9cc1c218afa9<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e0a\u8ff0\u7a0b\u5f0f\u7684\u57f7\u884c\u5be6\u4f8b\u5f71\u7247\uff1a<br \/>\n<iframe loading=\"lazy\" title=\"RGB LED\u4f7f\u7528\u96a8\u6a5f\u4e82\u6578\u51fd\u6578\u7684\u8f38\u51fa\u6548\u679c\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/X5bE_8L3MsA?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>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u524d\u4e00\u500b\u55ae\u5143\u4e2d\u6211\u5011\u4f7f\u7528\u7684\u662f\u6578\u4f4d\u8f38\u51fa\u5165\u7684\u63a5\u8173\uff0c\u6b64\u7a2e\u63a5\u8173\u9867\u540d\u601d\u7fa9\uff0c\u8f38\u51fa\u503c\u53ea\u6709HIGH\u548cLOW\u5169\u7a2e\uff0c\u56e0\u6b64\u5728\u4e0a\u4e00\u500b\u4f8b\u5b50&#8230;<\/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-1816","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\/1816","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=1816"}],"version-history":[{"count":0,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/1816\/revisions"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=1816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=1816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=1816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}