{"id":4403,"date":"2019-11-17T16:48:58","date_gmt":"2019-11-17T08:48:58","guid":{"rendered":"https:\/\/blog.hoyo.idv.tw\/?p=4403"},"modified":"2023-04-14T09:16:34","modified_gmt":"2023-04-14T01:16:34","slug":"esp8266-%e6%87%89%e7%94%a8%e4%b8%80%ef%bc%9a%e6%99%ba%e8%83%bd%e6%8f%92%e5%ba%a7-2-%e8%aa%8d%e8%ad%98-esp8266-%e5%8f%8a%e9%80%a3%e4%b8%8a-wifi","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=4403","title":{"rendered":"ESP8266 \u61c9\u7528\u4e00\uff1a\u667a\u80fd\u63d2\u5ea7 .2 \u8a8d\u8b58 ESP8266 \u53ca\u9023\u4e0a WiFi"},"content":{"rendered":"<h2>\u53c3\u8003<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.youtube.com\/channel\/UCCd23n-zY1Vfsvc9FLrZZbQ\/videos?disable_polymer=1\" target=\"_blank\" rel=\"noopener\">\u4f51\u4f86\u8a8d\u771f\u6559<\/a><\/li>\n<li><a href=\"http:\/\/frank1025.pixnet.net\/blog\/post\/278209177-esp8266-wifi%E4%B8%B2%E5%8F%A3%E6%A8%A1%E7%B5%84\" target=\"_blank\" rel=\"noopener\">ESP8266\u63cf\u8ff0\u8207\u529f\u80fd\u8aaa\u660e<\/a><\/li>\n<li><a href=\"https:\/\/blog.everlearn.tw\/nodemcu\/%E7%AC%AC%E4%B8%80%E6%AC%A1%E8%B3%BC%E8%B2%B7-nodemcu-%E5%B0%B1%E4%B8%8A%E6%89%8B\" target=\"_blank\" rel=\"noopener\">\u7b2c\u4e00\u6b21\u8cfc\u8cb7 NODEMCU \u5c31\u4e0a\u624b<\/a><\/li>\n<li><a href=\"https:\/\/frightanic.com\/iot\/comparison-of-esp8266-nodemcu-development-boards\/\" target=\"_blank\" rel=\"noopener\">Comparison of ESP8266 NodeMCU development boards<\/a><\/li>\n<li><a href=\"http:\/\/wyj-learning.blogspot.com\/2018\/10\/nodemcu-wemos-d1-based-on-esp8266.html\" target=\"_blank\" rel=\"noopener\">NodeMCU \u6559\u5b78 - 00\uff1aNodeMCU &amp; WeMos D1 (Based on ESP8266) \u8173\u4f4d\u4f7f\u7528\u6ce8\u610f<\/a><\/li>\n<\/ul>\n<p>\u521d\u671f\u53ea\u8981\u8ddf\u8457\u4f51\u8001\u5e2b\u7684 youtube \u5f71\u7247\u6559\u5b78\uff0c\u8cb7\u4e00\u584a ESP8266 \u7167\u8457\u505a\u4e00\u4e9b\u5be6\u9a57\u5c31\u5dee\u4e0d\u591a\u4e86<\/p>\n<p>Hoyo \u662f\u8cb7\u9019\u500b (<a href=\"http:\/\/goods.ruten.com.tw\/item\/show?21647522142501\">NodeMCU \u958b\u767c\u677f ESP8266\u4e32\u53e3WiFi\u6a21\u584a ESP-12E Lua \u7269\u806f\u7db2 CP2102 (NOD002)<\/a>) \u56e0\u70ba\u5728\u53f0\u5357\u53ef\u4ee5\u76f4\u63a5\u53bb\u62ff\u6bd4\u8f03\u65b9\u4fbf<\/p>\n<p>--<\/p>\n<h2>NodeMcu \u8173\u4f4d\u5716<\/h2>\n<p>NodeMcu \u677f\u4e0a LED \u662f D4 (GPIO2)\uff0c\u4e00\u958b\u59cb\u6c92\u6709\u5176\u4ed6\u786c\u9ad4\u914d\u5408\u53ef\u4ee5\u5148\u5617\u8a66\u63a7\u5236\u9019\u500b\u71c8\u865f<\/p>\n<p><a href=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/06\/nodemcu-devkit-instruction-en.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-5936\" src=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/06\/nodemcu-devkit-instruction-en-300x252.png\" alt=\"\" width=\"300\" height=\"252\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/06\/nodemcu-devkit-instruction-en-300x252.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/06\/nodemcu-devkit-instruction-en-768x644.png 768w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/06\/nodemcu-devkit-instruction-en-1024x859.png 1024w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/06\/nodemcu-devkit-instruction-en-358x300.png 358w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/06\/nodemcu-devkit-instruction-en.png 1344w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<figure id=\"attachment_6416\" aria-describedby=\"caption-attachment-6416\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_onboard_led.jpg\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"wp-image-6416 size-medium\" src=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_onboard_led-300x300.jpg\" alt=\"\" width=\"300\" height=\"300\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_onboard_led-300x300.jpg 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_onboard_led-150x150.jpg 150w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_onboard_led-768x768.jpg 768w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_onboard_led.jpg 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-6416\" class=\"wp-caption-text\">ESP8266 \u53ef\u63a7\u5236 LED \u71c8\u865f<\/figcaption><\/figure>\n<p>--<\/p>\n<h2>USB \u9a45\u52d5<\/h2>\n<p>USB\\VID_1A86&amp;PID_7523<\/p>\n<p>http:\/\/www.arduined.eu\/files\/CH341SER.zip<\/p>\n<p>--<\/p>\n<h2>Arduino \u958b\u767c\u74b0\u5883\u8a2d\u5b9a<\/h2>\n<p>Hoyo \u9078\u64c7\u7684\u662f Arduino \u958b\u767c\uff0c\u6240\u4ee5\u8acb\u5230 <a href=\"https:\/\/www.arduino.cc\/\" target=\"_blank\" rel=\"noopener\">Arduino<\/a> \u5b98\u7db2\u4e0b\u8f09\uff0c\u521d\u5b78\u8005\u5efa\u8b70\u76f4\u63a5\u4e0b\u8f09\u5b89\u88dd\u6a94\u6bd4\u8f03\u7701\u4e8b<\/p>\n<p>\u5b89\u88dd\u5b8c\u6210\u958b\u555f\u5148\u8b93 Arduino IDE \u652f\u63f4 ESP8266<\/p>\n<p>\u6a94\u6848 \u2192 \u504f\u597d\u8a2d\u5b9a \u2192 \u984d\u5916\u7684\u958b\u767c\u677f\u7ba1\u7406\u8005\u7db2\u5740\uff0c\u8f38\u5165\u4ee5\u4e0b\u7db2\u5740<\/p>\n<pre class=\"lang:default decode:true  \">https:\/\/arduino.esp8266.com\/stable\/package_esp8266com_index.json<\/pre>\n<p>\u5de5\u5177 \u2192 \u958b\u767c\u677f \u2192 \u958b\u767c\u677f\u7ba1\u7406\u54e1\uff0c\u904e\u6ffe\u8f38\u5165 esp8266 \u9078\u64c7\u7248\u672c\u5b89\u88dd\uff0c\u8acb\u4f7f\u7528 2.5.0 \u4ee5\u5f8c\u7248\u672c<\/p>\n<p><a href=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Image-20191116-165659.png\" data-rel=\"lightbox-image-2\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-6420\" src=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Image-20191116-165659-300x169.png\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Image-20191116-165659-300x169.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Image-20191116-165659-768x432.png 768w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Image-20191116-165659-500x281.png 500w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Image-20191116-165659.png 800w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>--<\/p>\n<h2>\u63a7\u5236\u677f\u4e0a\u7684 LED \u9583\u720d<\/h2>\n<p>\u7b2c\u4e00\u500b\u7a0b\u5f0f\u5c31\u662f\u8b93\u4e0a\u9762\u8aaa\u7684\u677f\u4e0a LED \u9583\u720d<\/p>\n<pre class=\"lang:arduino decode:true\">void setup() {\r\n  pinMode(D4, OUTPUT);\r\n}\r\n\r\nvoid loop() {\r\n  digitalWrite(D4, HIGH);\r\n  delay(1000);\r\n  digitalWrite(D4, LOW);\r\n  delay(1000);\r\n}<\/pre>\n<p>\u5132\u5b58\u5f8c\u4e0a\u50b3\u5230 ESP8266 \u57f7\u884c\u5373\u53ef\u770b\u5230\u9583\u720d\u7684 LED<\/p>\n<p>--<\/p>\n<h2>\u9023\u4e0a WiFi &amp; \u8b80\u53d6\u7db2\u9801<\/h2>\n<p>\u7b2c\u4e8c\u6b65\u5c31\u662f\u9023\u4e0a WiFi \u4e26\u4e14\u8b80\u53d6\uff0c\u8a18\u5f97\u4fee\u6539\u6210\u81ea\u5df1 WiFi AP \u540d\u7a31\u548c\u5bc6\u78bc<\/p>\n<pre class=\"lang:arduino decode:true\">#include &lt;ESP8266WiFi.h&gt;\r\n\r\n\/\/\r\nconst char* ssid = \"WiFi AP \u540d\u7a31\";\r\nconst char* password = \"WiFi \u5bc6\u78bc\";\r\n\r\nWiFiClient client;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n\r\n  WiFi.mode(WIFI_STA);\r\n  WiFi.begin(ssid, password);\r\n  while (WiFi.status() != WL_CONNECTED) {\r\n    delay(500);\r\n    Serial.println(\".\");\r\n  }\r\n\r\n  Serial.println(\"WiFi connected\");\r\n\r\n  if (client.connect(\"iot.hoyo.idv.tw\", 80)) {\r\n    Serial.println(\"connected\");\r\n    \/\/ Make a HTTP request:\r\n    client.println(\"GET \/ HTTP\/1.0\");\r\n    client.println();\r\n\r\n    String line = client.readStringUntil('\\n');\r\n    Serial.println(line);\r\n  }\r\n}\r\n\r\nvoid loop() {\r\n}<\/pre>\n<ul>\n<li>WIFI_AP : AP \u6a21\u5f0f<\/li>\n<li>WIFI_STA : Client \u6a21\u5f0f<\/li>\n<li>WIFI_AP_STA : \u540c\u6642\u662f AP \u4e5f\u662f Client<\/li>\n<li>WIFI_OFF : \u95dc\u9589<\/li>\n<\/ul>\n<p>\u53ef\u4ee5\u6253\u958b\u300c\u5e8f\u5217\u57e0\u76e3\u63a7\u8996\u7a97\u300d\u89c0\u5bdf\u904b\u884c\u7d50\u679c<\/p>\n<p><a href=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_ReadWebPage.png\" data-rel=\"lightbox-image-3\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-6426\" src=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_ReadWebPage-300x207.png\" alt=\"\" width=\"300\" height=\"207\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_ReadWebPage-300x207.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_ReadWebPage-435x300.png 435w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/ESP8266_ReadWebPage.png 656w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"4403\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;19,910&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u53c3\u8003 \u4f51\u4f86\u8a8d\u771f\u6559 ESP826...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"4403\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;19,910&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[273,306,272],"tags":[275,331],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/4403"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4403"}],"version-history":[{"count":26,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/4403\/revisions"}],"predecessor-version":[{"id":7740,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/4403\/revisions\/7740"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}