{"id":5,"date":"2018-11-13T00:31:25","date_gmt":"2018-11-13T00:31:25","guid":{"rendered":"https:\/\/www.meryun.com\/?p=5"},"modified":"2020-11-13T00:50:05","modified_gmt":"2020-11-13T00:50:05","slug":"esp8266-for-arduino%e5%9f%ba%e7%a1%80%e7%af%87-%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85esp8266%e7%9a%84arduino%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/www.meryun.com\/index.php\/2018\/11\/13\/esp8266-for-arduino%e5%9f%ba%e7%a1%80%e7%af%87-%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85esp8266%e7%9a%84arduino%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83\/","title":{"rendered":"ESP8266 For  Arduino\u57fa\u7840\u7bc7 \u5982\u4f55\u5b89\u88c5ESP8266\u7684Arduino\u5f00\u53d1\u73af\u5883"},"content":{"rendered":"\n<p class=\"has-text-align-left\"><br><strong>\u672c\u7f51\u7ad9\u6240\u6709\u6e90\u7801\u548c\u6587\u7ae0\u5747\u4e3a\u4f5c\u8005\u63d0\u4f9b\u548c\u7f51\u53cb\u63a8\u8350\u6536\u96c6\u6574\u7406\u800c\u6765\uff0c\u5bf9\u63d0\u4f9b\u7684\u6e90\u7801\u4e0d\u62e5\u6709\u4efb\u4f55\u6743\u5229\uff0c\u5176\u7248\u6743\u5f52\u539f\u8457\u8005\u62e5\u6709\u3002\u4ec5\u4f9b\u5b66\u4e60\u548c\u7814\u7a76\u4f7f\u7528,\u4e0b\u8f7d\u540e\u8bf724\u5c0f\u65f6\u5185\u5220\u9664\u3002\u4e0d\u5f97\u4f7f\u7528\u4e8e\u975e\u6cd5\u5546\u4e1a\u7528\u9014\uff0c\u4e0d\u5f97\u7ecf\u8425\u975e\u6cd5\u6e38\u620f\u6216\u8fdd\u53cd\u56fd\u5bb6\u6cd5\u5f8b\u3002\u4e00\u5207\u5173\u4e8e\u8be5\u8d44\u6e90\u5546\u4e1a\u884c\u4e3a\u4e0ewww.meryun.com\u65e0\u5173\u3002<\/strong><\/p>\n\n\n\n<p><strong>1. \u786c\u4ef6<\/strong><br>\u2002\u2002\u2002\u2002ESP8266\u6a21\u5757\uff0c\u6216\u8005ESP8266\u5f00\u53d1\u677f\uff0c\u5efa\u8bae\u521d\u5b66\u8005\u76f4\u63a5\u4f7f\u7528\u5f00\u53d1\u677f\uff1b<br>\u2002\u2002\u2002\u2002<strong>2. \u8f6f\u4ef6<\/strong><br>\u2002\u2002\u2002\u2002Arduino IDE\u5f00\u53d1\u73af\u5883\uff1b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. \u786c\u4ef6<\/h2>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u786c\u4ef6\u73af\u5883\u4e3b\u8981\u5206\u4e3a\u4e24\u79cd\uff1a<br>\u2002\u2002\u2002\u2002<strong>1. ESP8266\u5f00\u53d1\u677f + USB\u7ebf<\/strong><br>\u2002\u2002\u2002\u2002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/20200108161329470.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"\/><\/figure>\n\n\n\n<p>\u2002<strong>2. ESP8266\u6a21\u5757 + USB\u8f6cTTL\u7ebf<\/strong><br>\u2002\u2002\u2002\u2002\u5982\u679cWiFi\u6a21\u5757\u662fESP8266-01\u7cfb\u5217\uff0c\u9996\u5148\u8bf7\u770b\u4e00\u4e0b\u4ee5\u4e0b\u5f15\u811a\u63a5\u53e3\u8bf4\u660e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"\"><thead><tr><th>\u5f15\u811a\u7f16\u53f7<\/th><th>\u5f15\u811a\u5b9a\u4e49<\/th><th>\u5f15\u811a\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>TX<\/td><td>1\uff09UART_TX\u53d1\u9001\u7aef\uff1b2\uff09\u901a\u7528IO\u53e3\uff1aGPIO1\uff1b<\/td><\/tr><tr><td>2<\/td><td>GND<\/td><td>GND<\/td><\/tr><tr><td>3<\/td><td>CH_PD<\/td><td>1\uff09\u9ad8\u7535\u5e73\u5de5\u4f5c\uff1b2\uff09\u4f4e\u7535\u5e73\u6a21\u5757\u4f9b\u7535\u5173\u6389\uff1b<\/td><\/tr><tr><td>4<\/td><td>GPIO2<\/td><td>\u5f00\u673a\u4e0a\u7535\u65f6\u5fc5\u987b\u4e3a\u9ad8\u7535\u5e73\uff0c\u7981\u6b62\u786c\u4ef6\u4e0b\u62c9\uff0c\u5185\u90e8\u9ed8\u8ba4\u5df2\u62c9\u9ad8\uff1b<\/td><\/tr><tr><td>5<\/td><td>GPIO16<\/td><td>\u5916\u90e8Reset\u4fe1\u53f7\uff0c\u4f4e\u7535\u5e73\u590d\u4f4d\uff0c\u9ad8\u7535\u5e73\u5de5\u4f5c\uff08\u9ed8\u8ba4\u5e94\u8be5\u662f\u9ad8\u7535\u5e73\uff09\uff1b<\/td><\/tr><tr><td>6<\/td><td>GPIO0<\/td><td>\u63a5\u5730\u8fdb\u5165\u70e7\u5f55\u56fa\u4ef6\u6a21\u5f0f\uff0c\u60ac\u7a7a\u4e3a\u6b63\u5e38\u8fd0\u884c\u6a21\u5f0f\uff1b<\/td><\/tr><tr><td>7<\/td><td>VCC<\/td><td>3.3V\uff08\u5207\u8bb0\u4e0d\u8981\u4f9b5V\uff01\uff01\uff01\uff09<\/td><\/tr><tr><td>8<\/td><td>RX<\/td><td>1\uff09UART_RX\u63a5\u6536\u7aef\uff1b2\uff09\u901a\u7528IO\u53e3\uff1aGPIO3\uff1b<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u5176\u4f59\u5f15\u811a\u60ac\u7a7a\u5373\u53ef\u3002 \u4ece\u5f15\u811a\u4ecb\u7ecd\u8868\u53ef\u4ee5\u770b\u51fa\uff0c\u5173\u952e\u5f15\u811aGPIO0\u51b3\u5b9a\u4e86\u6a21\u5757\u5f53\u524d\u5904\u4e8e\u4ec0\u4e48\u5de5\u4f5c\u6a21\u5f0f\u3002<\/p>\n\n\n\n<p><strong>\u70e7\u5f55\u56fa\u4ef6\u6a21\u5f0f<\/strong><\/p>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u8bf7\u6309\u7167\u4e0b\u56fe\u8fde\u63a5ESP8266-01\u548cUSB\u8f6cTTL\u7ebf\uff0c\u8fdb\u5165\u70e7\u5f55\u6a21\u5f0f\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/imgconvert.csdnimg.cn\/aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3Rpbmd5b3V3dS9BcmR1aW5vL21hc3Rlci8lRTclQUMlQUMyJUU3JUFCJUEwXyVFNSU5QiVCRTlfRVNQODI2Ni0wMSVFNyU4MyVBNyVFNSVCRCU5NS5wbmc?x-oss-process=image\/format,png\" alt=\"image\"\/><\/figure>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u5982\u679cWiFi\u6a21\u5757\u662fESP8266-12\u7cfb\u5217\uff0c\u6309\u7167\u4e0b\u56fe\u5bf9\u5e94\u5f15\u811a\u63a5\u7ebf\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/imgconvert.csdnimg.cn\/aHR0cDovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vdGluZ3lvdXd1L0FyZHVpbm8vbWFzdGVyLyVFNyVBQyVBQzIlRTclQUIlQTBfJUU1JTlCJUJFOF9FU1AxMkYlRTYlOEUlQTUlRTclQkElQkYlRTUlOUIlQkUucG5n?x-oss-process=image\/format,png\" alt=\"image\"\/><\/figure>\n\n\n\n<p><strong>\u6e29\u99a8\u63d0\u793a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u4eceArduino IDE\u89d2\u5ea6\u6765\u770b\uff0cESP8266\u5de5\u4f5c\u6a21\u5f0f\u5305\u62ec\uff1a<br><strong>1.\u70e7\u5f55\u56fa\u4ef6\u6a21\u5f0f<\/strong><br>\u4e0b\u8f7d\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u9700\u8981\u5c06GPIO0\u53e3\u63a5\u5730\uff1b<br><strong>2.\u6b63\u5e38\u5de5\u4f5c\u6a21\u5f0f<\/strong><br>\u4e0b\u8f7d\u5b8c\u4ee3\u7801\uff0c\u9700\u8981\u5c06GPIO0\u53e3\u60ac\u7a7a\uff1b<br>\u6709\u7535\u8def\u7ecf\u9a8c\u7684\u8bfb\u8005\u53ef\u4ee5\u5b89\u88c5\u62e8\u7801\u5f00\u5173\u6765\u5207\u6362\u5de5\u4f5c\u6a21\u5f0f\u3002<\/li><li>\u6ce8\u610fESP8266\u5b89\u5168\u5de5\u4f5c\u7535\u538b\u662f3.3V\uff0c\u4e0d\u8981\u76f4\u63a5\u8fde\u63a55v\uff1b<\/li><li>\u624b\u52a8\u5207\u6362\u5de5\u4f5c\u6a21\u5f0f\u4e4b\u540e\uff0c\u6700\u597d\u91cd\u65b0\u542f\u52a8\u4e00\u4e0bESP8266\u6a21\u5757\uff08\u901a\u65ad\u7535\uff09\uff1b<\/li><li>\u6709\u65f6ESP8266\u4e0b\u8f7d\u5931\u8d25\uff0c\u6709\u53ef\u80fd\u662f\u4f9b\u7535\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u72ec\u7acb\u4f9b\u7535\uff0c\u4e0d\u76f4\u63a5\u8fde\u5230TTL Vcc;<\/li><li>\u70e7\u5f55\u56fa\u4ef6\uff0c\u6211\u4eec\u9700\u8981\u4e86\u89e3\u7684\u662f\uff0c\u6211\u4eec\u7684\u56fa\u4ef6\u662f\u4ee5\u4e0b\u54ea\u4e00\u79cd\uff1aAT\u56fa\u4ef6\u3001\u81ea\u5df1\u7f16\u5199\u7684SDK\u56fa\u4ef6\uff08\u57fa\u4e8eESP8266 SDK\u5f00\u53d1\u6216\u8005Lua\uff09\u4ee5\u53ca\u672c\u4e66\u57fa\u4e8eArduino\u5e73\u53f0\u5f00\u53d1\u7684ESP8266\u56fa\u4ef6<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u8f6f\u4ef6\u5f00\u53d1\u73af\u5883<\/h2>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u8f6f\u4ef6\u5b89\u88c5\u9700\u8981\u5206\u6210\u4e24\u4e2a\u6b65\u9aa4\uff1a<br>\u2002\u2002\u2002\u2002<strong>1.\u5b89\u88c5Arduino IDE<\/strong><br>\u2002\u2002\u2002\u2002Arduino IDE\u5f00\u53d1\u73af\u5883\u4e3b\u8981\u7528\u4e8eArduino Uno\/Mini\/Mega2560\u7b49\u5e73\u53f0\u7684\u9879\u76ee\u5f00\u53d1\u3002\u800cESP8266\u4e5f\u53ef\u4ee5\u57fa\u4e8e\u8be5IDE\u6765\u5f00\u53d1\uff0c \u6240\u4ee5\u6211\u4eec\u9996\u5148\u9700\u8981\u5b89\u88c5\u5b83\uff1b<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 \u5b89\u88c5Arduino IDE<\/h3>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u7531\u4e8e\u67d0\u4e9b\u539f\u56e0\uff0cArduino\u5b98\u7f51\u7f51\u7ad9\uff08https:\/\/www.arduino.cc\/en\/Main\/Software\uff09 \u7ecf\u5e38\u6253\u4e0d\u5f00\u6216\u8005\u4e0b\u8f7d\u901f\u5ea6\u6781\u6162\uff0c\u5bfc\u81f4\u4e0b\u8f7dIDE\u975e\u5e38\u56f0\u96be\uff0c\u8bfb\u8005\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u4e0b\u8f7d\u5b89\u88c5\uff1a\u901a\u8fc7Arduino\u4e2d\u6587\u793e\u533a\u94fe\u63a5\u5730\u5740\uff08https:\/\/www.arduino.cn\/thread-5838-1-1.html\uff09 \u53bb\u4e0b\u8f7d\u3002<\/p>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u5982\u679c\u4f60\u4e0b\u8f7d\u7684\u662fwindows\u5b89\u88c5\u7248\uff08exe\u540e\u7f00\uff09\uff0c\u90a3\u4e48\u76f4\u63a5\u5b89\u88c5\u5373\u53ef\uff0c\u5176\u4ed6\u5219\u76f4\u63a5\u89e3\u538b\u5373\u53ef\u4f7f\u7528\uff0c\u6ce8\u610f\u8def\u5f84\u4e0d\u8981\u5b58\u5728\u4e2d\u6587\u76ee\u5f55\u3002\u542f\u52a8Arduino\uff0c\u4f1a\u51fa\u73b0\u5982\u4e0b\u56fe\u6240\u793a\u754c\u9762\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/imgconvert.csdnimg.cn\/aHR0cHM6Ly93d3cuYXJkdWluby5jbi9kYXRhL2F0dGFjaG1lbnQvZm9ydW0vMjAxNTEyLzMxLzE3MTIzMmF3eGl1cWszNWY4YTNmdWEuanBn?x-oss-process=image\/format,png\" alt=\"image\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">2.2 \u5b89\u88c5ESP8266\u5f00\u53d1\u73af\u5883<\/h3>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u5b89\u88c5\u597dArduino IDE\u73af\u5883\u540e\uff0c\u5c31\u5f97\u5728\u5b83\u57fa\u7840\u4e0a\u914d\u7f6eArduino Core For ESP8266\u3002\u4ee5window\u7248\u672c\u4e3a\u4f8b\uff0c\u8bfb\u8005\u53ef\u4ee5\u5b89\u88c5\u4ee5\u4e0b\u987a\u5e8f\u5b89\u88c5\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u6253\u5f00Arduino IDE-&gt;\u83dc\u5355\u9879\u6587\u4ef6-&gt;\u9996\u9009\u9879\uff0c\u7136\u540e\u4f1a\u770b\u5230\u9644\u52a0\u5f00\u53d1\u7248\u7ba1\u7406\u5668\u7f51\u5740\uff0c\u586b\u5165http:\/\/arduino.esp8266.com\/stable\/package_esp8266com_index.json\uff0c\u91cd\u542fIDE\uff1b<br><\/li><li>\u91cd\u542fIDE\u4e4b\u540e-&gt;\u83dc\u5355\u9879\u5de5\u5177-&gt;\u5f00\u53d1\u677f-&gt;\u70b9\u51fb\u5f00\u53d1\u677f\u7ba1\u7406\u5668-&gt;\u6eda\u52a8\u627e\u5230ESP8266\u5e73\u53f0\uff1b<br><\/li><li>\u4ece\u4e0b\u62c9\u9009\u9879\u4e2d\u9009\u62e9\u4f60\u60f3\u4e0b\u8f7d\u7684\u7248\u672c\uff0c\u70b9\u51fb\u5b89\u88c5\uff0c\u9700\u8981\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u5b89\u88c5\u5b8c\u6bd5\u3002<\/li><li>\u5b89\u88c5\u6210\u529f\u7684\u8bdd\uff0c\u4f1a\u53ef\u4ee5\u770b\u5230\u4e0b\u56fe\u6240\u793a\u3002<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/imgconvert.csdnimg.cn\/aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3Rpbmd5b3V3dS9BcmR1aW5vL21hc3Rlci8lRTclQUMlQUMyJUU3JUFCJUEwXyVFNSU5QiVCRTE0X0VTUCUyMCVFNiVBMCVCOCVFNSVCRiU4MyVFNSVCQSU5My5wbmc?x-oss-process=image\/format,png\" alt=\"image\"\/><\/figure>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u5230\u6b64\uff0c\u6574\u4e2a\u8f6f\u4ef6\u5f00\u53d1\u73af\u5883\u642d\u5efa\u5b8c\u6bd5\u3002<\/p>\n\n\n\n<p><strong>\u6e29\u99a8\u63d0\u793a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5982\u679c\u5b89\u88c5\u5931\u8d25\uff0c\u4e00\u822c\u90fd\u662f\u56e0\u4e3a\u7f51\u7edc\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u591a\u6b21\u91cd\u65b0\u5b89\u88c5\uff1b\u591a\u6b21\u5b89\u88c5\u5931\u8d25\u4e4b\u540e\uff0c\u53ef\u80fd\u9700\u8981\u7ffb\u5899\uff1b<\/li><li>Arduino Core For ESP8266\u5e93\u7248\u672c\u4e4b\u95f4\u662f\u6709\u533a\u522b\uff0c\u6709\u4e9b\u7248\u672c\u53ef\u80fd\u6ca1\u6709\u67d0\u4e9b\u65b9\u6cd5\uff0c\u6bd4\u5982\u7b14\u8005\u521a\u5f00\u59cb\u7684\u65f6\u5019\u5b89\u88c5\u4e862.0.0\u7248\u672c\uff0c\u4f46\u662f\u7f16\u8bd1\u4ee3\u7801\u4e0d\u901a\u8fc7\uff0c\u63d0\u793aclient.peekBytes\u65b9\u6cd5\u4e0d\u5b58\u5728,\u5b89\u88c5\u6700\u65b0\u7248\u672c\u5b8c\u7f8e\u65e0bug\u3002<\/li><li>Arduino IDE\u754c\u9762\u76f8\u5bf9\u6bd4\u8f83\u7b80\u5355\uff0c\u7b14\u8005\u89c9\u5f97\u4ee3\u7801\u63d0\u793a\u529f\u80fd\u3001\u81ea\u52a8\u8865\u5168\u4e0d\u591f\u53cb\u597d\uff0c\u63a8\u8350\u4f7f\u7528Visual Studio\u3001Eclipse\u7b49\u66f4\u4e3a\u4e13\u4e1a\u7684\u5f00\u53d1\u73af\u5883\u8fdb\u884c\u5f00\u53d1\u3002\u8fd9\u4e9b\u7b2c\u4e09\u65b9\u7684\u5f00\u53d1\u73af\u5883\u90fd\u9700\u8981\u4e0b\u8f7d\u5bf9\u5e94\u7684Arduino\u63d2\u4ef6\u8fdb\u884c\u914d\u7f6e\uff0c\u7b14\u8005\u8fd9\u91cc\u5c31\u4e0d\u5177\u4f53\u8bb2\u89e3\uff0c\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u81ea\u884c\u67e5\u9605\u8d44\u6599\u89e3\u51b3\u3002<\/li><li><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u70e7\u5f55ESP8266<\/h2>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u5b9e\u9a8c\u662f\u68c0\u9a8c\u771f\u7406\u7684\u552f\u4e00\u6807\u51c6\uff0c\u914d\u7f6e\u597d\u786c\u4ef6\u548c\u8f6f\u4ef6\u73af\u5883\u4e4b\u540e\uff0c\u7b14\u8005\u5c31\u7ed9\u8bfb\u8005\u63d0\u4f9b\u4e00\u4e2a\u5b9e\u4f8b\u4ee3\u7801\uff0c\u5e76\u4e14\u544a\u8bc9\u8bfb\u8005\u5982\u4f55\u914d\u7f6e\u70e7\u5f55\u4ee5\u53ca\u63d0\u53ca\u4e00\u4e9b\u70e7\u5f55\u914d\u7f6e\u6ce8\u610f\u70b9\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3.1\u5b9e\u4f8b\u4ee3\u7801<\/h3>\n\n\n\n<p>\u2002\u2002\u2002\u2002\u9996\u5148\uff0c\u8bf7\u8bfb\u8005\u4e0d\u7528\u5728\u610f\u4ee3\u7801\u7ec6\u8282\u95ee\u9898\uff0c\u8bf7\u5148\u62f7\u8d1d\u5982\u4e0b\u4ee3\u7801\u5230Arduino IDE\uff0c\u7136\u540e\u70b9\u51fb\u7f16\u8bd1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\">\n\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:435px;height:300px;\"><div class=\"text codecolorer\">\/**<br \/>\n&nbsp; &nbsp;Authorization.ino<br \/>\n<br \/>\n&nbsp; &nbsp; Created on: 09.12.2015<br \/>\n<br \/>\n*\/<br \/>\n<br \/>\n#include &amp;lt;Arduino.h&gt;<br \/>\n<br \/>\n#include &amp;lt;ESP8266WiFi.h&gt;<br \/>\n#include &amp;lt;ESP8266WiFiMulti.h&gt;<br \/>\n<br \/>\n#include &amp;lt;ESP8266HTTPClient.h&gt;<br \/>\n<br \/>\n#include &amp;lt;WiFiClient.h&gt;<br \/>\n<br \/>\nESP8266WiFiMulti WiFiMulti;<br \/>\n<br \/>\nvoid setup() {<br \/>\n<br \/>\n&nbsp; Serial.begin(115200);<br \/>\n&nbsp; \/\/ Serial.setDebugOutput(true);<br \/>\n<br \/>\n&nbsp; Serial.println();<br \/>\n&nbsp; Serial.println();<br \/>\n&nbsp; Serial.println();<br \/>\n<br \/>\n&nbsp; for (uint8_t t = 4; t &gt; 0; t--) {<br \/>\n&nbsp; &nbsp; Serial.printf(&quot;[SETUP] WAIT %d...\\n&quot;, t);<br \/>\n&nbsp; &nbsp; Serial.flush();<br \/>\n&nbsp; &nbsp; delay(1000);<br \/>\n&nbsp; }<br \/>\n<br \/>\n&nbsp; WiFi.mode(WIFI_STA);<br \/>\n&nbsp; WiFiMulti.addAP(&quot;1502&quot;, &quot;18560052108&quot;);<br \/>\n<br \/>\n}<br \/>\n<br \/>\nvoid loop() {<br \/>\n&nbsp; \/\/ wait for WiFi connection<br \/>\n&nbsp; if ((WiFiMulti.run() == WL_CONNECTED)) {<br \/>\n<br \/>\n&nbsp; &nbsp; WiFiClient client;<br \/>\n<br \/>\n&nbsp; &nbsp; HTTPClient http;<br \/>\n<br \/>\n&nbsp; &nbsp; Serial.print(&quot;[HTTP] begin...\\n&quot;);<br \/>\n&nbsp; &nbsp; \/\/ configure traged server and url<br \/>\n<br \/>\n<br \/>\n&nbsp; &nbsp; http.begin(client, &quot;http:\/\/xxx.com\/1.php&quot;);<br \/>\n<br \/>\n&nbsp; &nbsp; \/*<br \/>\n&nbsp; &nbsp; &nbsp; \/\/ or<br \/>\n&nbsp; &nbsp; &nbsp; http.begin(client, &quot;http:\/\/jigsaw.w3.org\/HTTP\/Basic\/&quot;);<br \/>\n&nbsp; &nbsp; &nbsp; http.setAuthorization(&quot;guest&quot;, &quot;guest&quot;);<br \/>\n<br \/>\n&nbsp; &nbsp; &nbsp; \/\/ or<br \/>\n&nbsp; &nbsp; &nbsp; http.begin(client, &quot;http:\/\/jigsaw.w3.org\/HTTP\/Basic\/&quot;);<br \/>\n&nbsp; &nbsp; &nbsp; http.setAuthorization(&quot;Z3Vlc3Q6Z3Vlc3Q=&quot;);<br \/>\n&nbsp; &nbsp; *\/<br \/>\n<br \/>\n<br \/>\n&nbsp; &nbsp; Serial.print(&quot;[HTTP] GET...\\n&quot;);<br \/>\n&nbsp; &nbsp; \/\/ start connection and send HTTP header<br \/>\n&nbsp; &nbsp; int httpCode = http.GET();<br \/>\n<br \/>\n&nbsp; &nbsp; \/\/ httpCode will be negative on error<br \/>\n&nbsp; &nbsp; if (httpCode &gt; 0) {<br \/>\n&nbsp; &nbsp; &nbsp; \/\/ HTTP header has been send and Server response header has been handled<br \/>\n&nbsp; &nbsp; &nbsp; Serial.printf(&quot;[HTTP] GET... code: %d\\n&quot;, httpCode);<br \/>\n<br \/>\n&nbsp; &nbsp; &nbsp; \/\/ file found at server<br \/>\n&nbsp; &nbsp; &nbsp; if (httpCode == HTTP_CODE_OK) {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; String payload = http.getString();<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; Serial.println(payload);<br \/>\n&nbsp; &nbsp; &nbsp; }<br \/>\n&nbsp; &nbsp; } else {<br \/>\n&nbsp; &nbsp; &nbsp; Serial.printf(&quot;[HTTP] GET... failed, error: %s\\n&quot;, http.errorToString(httpCode).c_str());<br \/>\n&nbsp; &nbsp; }<br \/>\n<br \/>\n&nbsp; &nbsp; http.end();<br \/>\n&nbsp; }<br \/>\n<br \/>\n&nbsp; delay(10000);<br \/>\n}<\/div><\/div>\n\n<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u7f51\u7ad9\u6240\u6709\u6e90\u7801\u548c\u6587\u7ae0\u5747\u4e3a\u4f5c\u8005\u63d0\u4f9b\u548c\u7f51\u53cb\u63a8\u8350\u6536\u96c6\u6574\u7406&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/posts\/5","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":4,"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":9,"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/posts\/5\/revisions\/9"}],"wp:attachment":[{"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.meryun.com\/index.php\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}