{"id":856,"date":"2021-05-17T11:57:11","date_gmt":"2021-05-17T03:57:11","guid":{"rendered":"https:\/\/104.es\/?p=856"},"modified":"2021-05-17T11:57:11","modified_gmt":"2021-05-17T03:57:11","slug":"nodemcu-python-02","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2021\/05\/17\/nodemcu-python-02\/","title":{"rendered":"NodeMCU\u7684Python\u958b\u767c\u6307\u5357\uff08\u4e8c\uff09\u9023\u7dda\u8207Python\u97cc\u9ad4\u71d2\u9304"},"content":{"rendered":"\n<p>\u8981\u4f7f\u7528Python\u958b\u767cNodeMCU\u7684\u4e00\u500b\u6700\u91cd\u8981\u7684\u89c0\u5ff5\u5c31\u662f\uff0c\u8981\u5728NodeMCU\u7684\u677f\u5b50\u4e0a\u91cd\u65b0\u71d2\u9304\u5b83\u7684\u97cc\u9ad4\uff08firmware\uff09\uff0c\u4e5f\u5c31\u662f\u8981\u628a\u80fd\u5920\u652f\u63f4Python\u8a9e\u6cd5\u7684\u76f4\u8b6f\u5668\u53ca\u57f7\u884c\u74b0\u5883\u5148\u300c\u653e\u5728\u300d\u5728\u677f\u5b50\u4e2d\uff0c\u5728\u677f\u5b50\u91cd\u65b0\u958b\u6a5f\u4e4b\u5f8c\uff0c\u5b83\u624d\u80fd\u5920\u63a5\u53d7Python\u6240\u7de8\u5beb\u7684\u7a0b\u5f0f\u3002<\/p>\n\n\n\n<p>\u5728\u628aNodeMCU\u7528MicroUSB\u7dda\u9023\u63a5\u5230\u96fb\u8166\u4e0a\u4e4b\u5f8c\uff0c\u5982\u679c\u662fWindow 10\u4f5c\u696d\u7cfb\u7d71\u7684\u8a71\uff0c\u8acb\u5230Windwos\u8a2d\u5b9a\u4e2d\u7684\u88dd\u7f6e\u6aa2\u8996\u662f\u5426\u6709\u4ee5\u4e0b\u6240\u6846\u8d77\u4f86\u7684\u9a45\u52d5\u7a0b\u5f0f\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1022\" height=\"726\" src=\"http:\/\/104es.nkust.org\/wp-content\/uploads\/2021\/05\/image-5.png?w=1022\" alt=\"\" class=\"wp-image-859\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-5.png 1022w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-5-300x213.png 300w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-5-768x546.png 768w\" sizes=\"auto, (max-width: 1022px) 100vw, 1022px\" \/><\/figure>\n\n\n\n<p>\u65b0\u7248\u7684Windows 10\u4f5c\u696d\u7cfb\u7d71\u57fa\u672c\u4e0a\u9023\u7dda\u4e4b\u5f8c\u90fd\u53ef\u4ee5\u76f4\u63a5\u5b89\u88dd\u9069\u7576\u7684\u9a45\u52d5\u7a0b\u5f0f\uff0c\u5982\u679c\u6c92\u6709\u7684\u8a71\uff0c\u5c31\u8981\u81ea\u884c\u53bb\u5c0b\u627e\u76f8\u95dc\u7684USB\u9a45\u52d5\u7a0b\u5f0f\uff0c\u76f4\u5230\u5728\u88dd\u7f6e\u4e2d\u53ef\u4ee5\u770b\u5230COM\u7684\u9023\u63a5\u57e0\u865f\u624d\u53ef\u4ee5\u9032\u5165\u4e0b\u4e00\u500b\u6b65\u9a5f\u3002\u5728\u6b64\u4f8b\u4e2d\uff0c\u6211\u5011\u53ea\u8981\u900f\u904eCOM7\u5c31\u80fd\u5920\u5b58\u53d6NodeMCU\u3002<\/p>\n\n\n\n<p>\u5728\u78ba\u5b9a\u53ef\u4ee5\u9023\u7dda\u7684\u72c0\u614b\u4e0b\uff0c\u63a5\u4e0b\u4f86\u8981\u53bb\u4ee5\u4e0b\u7684\u7db2\u5740\u4e0b\u8f09MicroPython\u7684\u97cc\u9ad4<\/p>\n\n\n\n<p><a href=\"https:\/\/micropython.org\/download\/esp8266\/\">https:\/\/micropython.org\/download\/esp8266\/<\/a><\/p>\n\n\n\n<p>\u5230\u8a72\u7db2\u7ad9\u4e4b\u5f8c\u53ef\u4ee5\u770b\u5230\u8a31\u591a\u53ef\u4ee5\u4e0b\u8f09\u7684\u7248\u672c\uff0c\u8acb\u9078\u64c7\u6700\u65b0\u7248\u4e0b\u8f09\u5373\u53ef\u3002\u4e0b\u8f09\u6642\u8acb\u7559\u610f\u6a94\u6848\u7684\u4f4d\u7f6e\uff0c\u4e00\u5b9a\u8981\u653e\u5728\u4f60\u57f7\u884cPython\u74b0\u5883\u7684\u76ee\u9304\u4e0b\u3002\u5982\u679c\u6c92\u6709\u7279\u5225\u8a2d\u5b9a\u7684\u8a71\uff0c\u5c31\u8acb\u628a\u5b83\u4e0b\u8f09\u5230\u4f60\u7684\u4f7f\u7528\u8005\u5bb6\u76ee\u9304\u4e4b\u4e0b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1004\" height=\"483\" src=\"http:\/\/104es.nkust.org\/wp-content\/uploads\/2021\/05\/image-6.png?w=1004\" alt=\"\" class=\"wp-image-861\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-6.png 1004w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-6-300x144.png 300w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-6-768x369.png 768w\" sizes=\"auto, (max-width: 1004px) 100vw, 1004px\" \/><\/figure>\n\n\n\n<p>\u5728\u9019\u500b\u4f8b\u5b50\u4e2d\uff0c\u6211\u5011\u662f\u628a\u5b83\u653e\u5728D:\\course\\nodemcu\u8cc7\u6599\u593e\u4e0b\uff0c\u56e0\u70ba\u6211\u5011\u7684Python\u57f7\u884c\u74b0\u5883\u4e5f\u662f\u5728\u8a72\u8cc7\u6599\u593e\u4e0b\u3002\u6709\u4e86\u9019\u500b\u97cc\u9ad4\u6a94\u6848\u4e4b\u5f8c\uff0c\u9084\u8981\u6709\u80fd\u5920\u71d2\u9304\u4e0a\u53bb\u7684\u5de5\u5177\u7a0b\u5f0f\uff0c\u65e2\u7136\u6211\u5011\u6253\u7b97\u4f7f\u7528MicroPython\u958b\u767c\uff0c\u6240\u4ee5\u7576\u7136\u5c31\u662f\u8981\u4f7f\u7528Python\u7684\u71d2\u9304\u5de5\u5177esptool\uff0c\u6b64\u5de5\u5177\u53ea\u8981\u5728Python\u7684\u53ef\u7528\u74b0\u5883\u4e0b\u900f\u904epip install esptool\u5373\u53ef\u9806\u5229\u5b8c\u6210\u5b89\u88dd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install esptool<\/code><\/pre>\n\n\n\n<p>\u5728\u5b89\u88dd\u5b8cesptool\u4e4b\u5f8c\uff0c\u5373\u53ef\u4ee5\u5982\u4e0b\u7684\u547d\u4ee4\u5148\u62b9\u9664\u539f\u6709\u7684\u97cc\u9ad4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>esptool --port COM7 erase_flash<\/code><\/pre>\n\n\n\n<p>\u4e0b\u5716\u662f\u5728Windows 10\u4e0b\u57f7\u884c\u62b9\u9664\u4f5c\u696d\u7684\u904e\u7a0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/104es.nkust.org\/wp-content\/uploads\/2021\/05\/image-7.png?w=855\" alt=\"\" class=\"wp-image-864\" width=\"413\" height=\"223\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-7.png 855w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-7-300x162.png 300w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-7-768x416.png 768w\" sizes=\"auto, (max-width: 413px) 100vw, 413px\" \/><\/figure>\n\n\n\n<p>\u9806\u5229\u62b9\u9664\u539f\u6709\u7684\u97cc\u9ad4\u4e4b\u5f8c\uff0c\u63a5\u4e0b\u4f86\u8981\u4ee5\u5982\u4e0b\u7684\u6307\u4ee4\u628a\u65b0\u7684\u97cc\u9ad4\u71d2\u9304\u9032NodeMCU\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>esptool --port COM7 --baud 460800 write_flash --flash_size=detect -fm dio 0 esp8266-20210418-v1.15.bin<\/code><\/pre>\n\n\n\n<p>\u57f7\u884c\u4e0a\u8ff0\u6307\u4ee4\u4e4b\u524d\uff0c\u8acb\u52d9\u5fc5\u7559\u610f\u65b0\u7684\u97cc\u9ad4\u6a94\u6848\u540d\u7a31\uff0c\u4f60\u7684\u548c\u8001\u5e2b\u7684\u4e0d\u4e00\u5b9a\u6703\u4e00\u6a23\uff0c\u4ee5\u4e0b\u662f\u9806\u5229\u57f7\u884c\u7684\u904e\u7a0b\u756b\u9762\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1459\" height=\"728\" src=\"http:\/\/104es.nkust.org\/wp-content\/uploads\/2021\/05\/image-8.png?w=1024\" alt=\"\" class=\"wp-image-867\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-8.png 1459w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-8-300x150.png 300w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-8-1024x511.png 1024w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-8-768x383.png 768w\" sizes=\"auto, (max-width: 1459px) 100vw, 1459px\" \/><\/figure>\n\n\n\n<p>\u9806\u5229\u5b8c\u6210\u71d2\u9304\u4e4b\u5f8c\uff0c\u53ea\u8981\u6309\u4e0bNodeMCU\u4e0a\u7684RST\u6309\u9215\uff0c\u5c31\u505a\u597d\u4f7f\u7528MicroPython\u958b\u767cNodeMCU\u7684\u6e96\u5099\u5de5\u4f5c\u4e86\u3002<\/p>\n\n\n\n<p>\u6b64\u6642\u6700\u65b9\u4fbf\u7684\u65b9\u5f0f\u5c31\u662f\u9032\u5165<a href=\"https:\/\/codewith.mu\/\">MU Editor<\/a>\uff08\u9700\u5148\u4e0b\u8f09\u4e26\u5b8c\u6210\u5b89\u88dd\uff09\uff0c\u9032\u5165\u4e4b\u5f8c\u9078\u7528ESP MicroPython\u6a21\u5f0f\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1254\" height=\"700\" src=\"http:\/\/104es.nkust.org\/wp-content\/uploads\/2021\/05\/image-9.png?w=1024\" alt=\"\" class=\"wp-image-869\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-9.png 1254w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-9-300x167.png 300w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-9-1024x572.png 1024w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-9-768x429.png 768w\" sizes=\"auto, (max-width: 1254px) 100vw, 1254px\" \/><\/figure>\n\n\n\n<p>\u4f9d\u4e0a\u5716\u7bad\u982d\u6240\u6307\u7684\u4f4d\u7f6e\u6309\u4e0b\u300cREPL\u300d\u529f\u80fd\uff0c\u5373\u53ef\u5728\u4e0b\u65b9\u770b\u5230MicroPython v1.15\u7684\u4e92\u52d5\u5f0f\u57f7\u884c\u74b0\u5883\uff0c\u8a72\u74b0\u5883\u5c31\u662f\u6240\u9023\u63a5\u7684\u9019\u500bNodeMCU\u677f\u5b50\u4e0a\u7684Python Shell\uff0c\u6240\u6709\u8f38\u5165\u7684\u6307\u4ee4\uff0c\u90fd\u6703\u5728\u8a72\u677f\u5b50\u4e0a\u57f7\u884c\uff0c\u5982\u4e0b\u5716\u6240\u793a\u8f38\u5165\u6307\u4ee4\uff0c\u5373\u53ef\u628a\u677f\u5b50\u4e0a\u7684\u85cd\u8272LED\u6253\u958b\u5594\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1254\" height=\"646\" src=\"http:\/\/104es.nkust.org\/wp-content\/uploads\/2021\/05\/image-10.png?w=1024\" alt=\"\" class=\"wp-image-871\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-10.png 1254w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-10-300x155.png 300w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-10-1024x528.png 1024w, https:\/\/104.es\/wp-content\/uploads\/2021\/05\/image-10-768x396.png 768w\" sizes=\"auto, (max-width: 1254px) 100vw, 1254px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u4f7f\u7528Python\u958b\u767cNodeMCU\u7684\u4e00\u500b\u6700\u91cd\u8981\u7684\u89c0\u5ff5\u5c31\u662f\uff0c\u8981\u5728NodeMCU\u7684\u677f\u5b50\u4e0a\u91cd\u65b0\u71d2\u9304\u5b83\u7684\u97cc\u9ad4\uff08firmware\uff09\uff0c\u4e5f\u5c31\u662f\u8981\u628a\u80fd\u5920\u652f\u63f4Python\u8a9e\u6cd5\u7684\u76f4\u8b6f\u5668\u53ca\u57f7\u884c\u74b0\u5883\u5148\u300c\u653e\u5728\u300d\u5728\u677f\u5b50\u4e2d\uff0c\u5728\u677f\u5b50\u91cd\u65b0\u958b\u6a5f\u4e4b\u5f8c\uff0c\u5b83\u624d\u80fd\u5920\u63a5\u53d7Python\u6240\u7de8\u5beb\u7684\u7a0b\u5f0f\u3002\u672c\u6587\u5c07\u793a\u7bc4\u5982\u4f55\u9032\u884c\u64cd\u4f5c\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":[13],"tags":[],"class_list":["post-856","post","type-post","status-publish","format-standard","hentry","category-nodemcu"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/856","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=856"}],"version-history":[{"count":0,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/856\/revisions"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}