{"id":884,"date":"2016-06-15T17:04:28","date_gmt":"2016-06-15T09:04:28","guid":{"rendered":"https:\/\/swf.com.tw\/?p=884"},"modified":"2016-06-16T23:59:53","modified_gmt":"2016-06-16T15:59:53","slug":"arduino-uno-wifi-arduino-uno%e6%9d%bf-esp8266","status":"publish","type":"post","link":"https:\/\/swf.com.tw\/?p=884","title":{"rendered":"Arduino UNO WiFi = Arduino UNO\u677f + ESP8266"},"content":{"rendered":"<p>2016\u5e74\u5143\u65e6\u7576\u5929\uff0c\u6536\u5230<a href=\"http:\/\/www.arduino.org\/\" target=\"_blank\">Arduino S.R.L\u516c\u53f8\uff08arduino.org\uff09<\/a>\u5275\u8fa6\u4ebaFederico Musto\u5148\u751f\u5bc4\u4f86\u7684\u8056\u8a95\u79ae\u7269\uff1a<a href=\"http:\/\/www.arduino.org\/products\/boards\/arduino-uno-wifi\" target=\"_blank\">Arduino UNO WiFi\u63a7\u5236\u677f<\/a>\u3002<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/arduino_uno_wifi_board_1.jpg\" width=\"550\" height=\"512\" alt=\"Arduino UNO WiFi\u63a7\u5236\u677f\"\/><\/p>\n<p>\u8ddf\u65b0\u7684Arduino\u7cfb\u5217\u63a7\u5236\u677f\u4e00\u6a23\uff0cUNO WiFi\u677f\u7684\u6392\u63d2\u5916\u5074\u6709\u5370\u4e0a\u63a5\u8173\u7684\u7de8\u865f\uff08\u6240\u4ee5\u6211\u5011\u4e0d\u7528<a href=\"\/?p=791\" target=\"_blank\">\u81ea\u5df1\u641e\u8cbc\u7d19DIY<\/a>\u4e86\uff09\uff1a<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/arduino_uno_wifi_board_2.jpg\" width=\"550\" height=\"367\" alt=\"Arduino UNO WiFi\u63a7\u5236\u677f\"\/><\/p>\n<p>\u9019\u5f35\u63a7\u5236\u677f\u7684\u5c3a\u5bf8\u548cUNO\u4e00\u6a23\uff0c\u677f\u5b50\u4e0a\u6574\u5408\u4e86Arduino UNO\u548cESP8266\uff08\u5177\u5099Wi-Fi\u7db2\u8def\u9023\u7dda\u7684\u7cfb\u7d71\u7d1a\u6676\u7247\uff09\u3002\u5b83\u63a1\u7528ATmega328\u5fae\u63a7\u5668\u57f7\u884cArduino\u7a0b\u5f0f\uff0c\u4e26\u4e14\u540c\u6a23\u63a1\u7528ATmega16U2\u4f5c\u70baUSB\u5e8f\u5217\u57e0\u901a\u8a0a\u6676\u7247\u3002\u5ee3\u544a\u4e00\u4e0b\uff0cESP8266\u7684\u8aaa\u660e\u548c\u7a0b\u5f0f\u8a2d\u8a08\u8acb\u53c3\u95b1\u300a<a href=\"\/?p=844\" target=\"_blank\">\u8d85\u5716\u89e3\u7269\u806f\u7db2IoT\u5be6\u4f5c\u5165\u9580<\/a>\u300b\u7b2c12\u548c13\u7ae0\u3002<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/arduino_uno_wifi.png\" width=\"546\" height=\"372\" alt=\"Arduino UNO WiFi\u63a7\u5236\u677f\"\/><\/p>\n<p>ESP8266\u6676\u7247\u900f\u904e\u5e8f\u5217\u901a\u8a0a\u4ecb\u9762\u9023\u63a5\u5176\u4ed6\u5fae\u63a7\u5668\uff08\u5982\uff1aArduino\u677f\uff09\uff0c\u4f46\u7531\u65bcArduino\u63a7\u5236\u677f\u7684\u5e8f\u5217\u57e0\u80a9\u8ca0\u63a5\u6536\u7a0b\u5f0f\u78bc\u7684\u91cd\u8cac\u5927\u4efb\uff0c\u56e0\u6b64\uff0cUNO WiFi\u677f\u63a1\u7528NXP\uff08\u6069\u667a\u6d66\u534a\u5c0e\u9ad4\uff09\u7684SC16IS750IBS\u5e8f\u5217\u8f49I<sup>2<\/sup>C\/SPI\u4ecb\u9762\u7684\u6676\u7247\uff0c<strong>\u628aEP8266\u7684\u5e8f\u5217\u4ecb\u9762\u8f49\u63db\u6210I<sup>2<\/sup>C\uff0c\u518d\u9023\u63a5\u5230Arduino\u7684ATmega328\u5fae\u63a7\u5668\u3002<\/strong><\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/arduino_esp8266_bridge.png\" width=\"533\" height=\"196\" alt=\"SC16IS750IBS\u5e8f\u5217\u8f49I2C\/SPI\u4ecb\u9762\u7684\u4f5c\u7528\"\/><\/p>\n<p>\u5e73\u6642\uff0cArduino UNO\u7684\u7db2\u8def\u8cc7\u6599\u7d93\u7531I<sup>2<\/sup>C\u4ecb\u9762\uff08\u4ea6\u5373\uff1aA4\u548cA5\u8173\uff09\u50b3\u9001\u5230SC16IS750IBS\uff0c\u518d\u5f9e\u9019\u500b\u6676\u7247\u7684\u5e8f\u5217\u57e0\uff0c\u8f49\u9001\u7d66ESP8266\u6676\u7247\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002<\/p>\n<p>\u4e0a\u50b3\u7a0b\u5f0f\u7d66Arduino\u6642\uff0c\u9664\u4e86\u900f\u904e\u63a7\u5236\u677f\u7684USB\u4ecb\u9762\uff0c\u4e5f\u53ef\u4ee5\u7528Wi-Fi\u7121\u7dda\u65b9\u5f0f\u4e0a\u50b3\u3002<strong>\u900f\u904e\u7121\u7dda\u4e0a\u50b3\u7a0b\u5f0f\u6642\uff0c\u7a0b\u5f0f\u6a94\u5c07\u5f9eESP8266\u7684\u5e8f\u5217\u57e0\u76f4\u63a5\u50b3\u5165Arduino\u7684\u5e8f\u5217\u57e0<\/strong>\u3002ESP8266\u7684\u5e8f\u5217\u57e0\u548cI<sup>2<\/sup>C\u4ecb\u9762\u901a\u8a0a\u6703\u4f9d\u7167\u4f7f\u7528\u60c5\u6cc1\u81ea\u52d5\u5207\u63db\uff0c\u6211\u5011\u7684\u7a0b\u5f0f\u78bc\u7121\u9808\u4ecb\u5165\u3002<\/p>\n<h2>\u8a2d\u7f6eWi-Fi\u7db2\u8def\u548cESP8266\u7684\u904b\u4f5c\u6a21\u5f0f<\/h2>\n<p>Arduino Uno WiFi\u677f\u5b50\u4e0a\u768416M bit\uff082MB\uff09\u5feb\u9583\u8a18\u61b6\u9ad4\uff0c\u7528\u65bc\u5132\u5b58ESP8266\u7684\u97cc\u9ad4\uff0c\u6b64\u7db2\u8def\u6676\u7247\u7684\u9810\u8a2d\u5de5\u4f5c\u6a21\u5f0f\u70baAP+STA\uff0c\u4e5f\u5c31\u662f\u540c\u6642\u5145\u7576\u7db2\u8def\u57fa\u5730\u53f0\uff08Access Point\uff09\u548c\u7121\u7dda\u7d42\u7aef\u8a2d\u5099\uff08Station\uff09\u3002<\/p>\n<p>\u82e5\u8981\u555f\u7528<strong>OTA\uff08Over The Air\uff0c\u7121\u7dda\u4e0a\u50b3\u7a0b\u5f0f\u78bc\uff09<\/strong>\u529f\u80fd\uff0cESP8266\u5fc5\u9808\u5148<strong>\u8a2d\u7f6e\u6210STA\uff08\u7121\u7dda\u7d42\u7aef\uff09\u6a21\u5f0f<\/strong>\u3002Arduino UNO WiFi\u7684\u7121\u7dda\u7db2\u8def\u53c3\u6578\uff0c\u90fd\u662f\u7528\u700f\u89bd\u5668\u8a2d\u7f6e\u3002\u8a2d\u7f6e\u53c3\u6578\u4e4b\u524d\uff0c\u8981\u5148\u900f\u904eWi-Fi\u9023\u63a5\u6b64\u63a7\u5236\u677f\u3002<\/p>\n<p>\u63a5\u4e0a\u96fb\u6e90\u4e4b\u5f8c\u4e0d\u4e45\uff0c\u5373\u53ef\u63a2\u5c0b\u5230\u6b64\u63a7\u5236\u677f\u7684Wi-Fi\u8a0a\u865f\uff1a<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/wifi_connection.png\" width=\"320\" height=\"268\" alt=\"\u9023\u63a5Arduino UNO WiFi\u7684\u7121\u7dda\u7db2\u8def\"\/><\/p>\n<p>\u9023\u4e0aArduino Uno WiFi\u57fa\u5730\u53f0\uff0c\u518d\u900f\u904e\u700f\u89bd\u5668\u9023\u63a5\u5230http:\/\/192.168.240.1\/\u7db2\u5740\uff0c\u5373\u53ef\u9032\u5165\u6b64\u63a7\u5236\u677f\u7684\u7121\u7dda\u7db2\u8def\u8a2d\u7f6e\u756b\u9762\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/esp8266_wifi_setting.png\" width=\"1014\" height=\"528\" alt=\"Arduino UNO WiFi\u7684\u7121\u7dda\u7db2\u8def\u8a2d\u7f6e\u756b\u9762\"\/><\/p>\n<p>\u9019\u500b\u7db2\u9801\u7a0b\u5f0f\u5b58\u5728EP8266\u97cc\u9ad4\u4e2d\uff0c\u53ef\u986f\u793a\u7121\u7dda\u7db2\u8def\u7684\u904b\u4f5c\u72c0\u6cc1\u548c\u8cc7\u8a0a\uff0c\u4f8b\u5982\uff0cIP\u4f4d\u5740\u3001MAC\u4f4d\u5740\u3001\u5de5\u4f5c\u6a21\u5f0f&#8230;\u7b49\u7b49\uff0c\u4e5f\u6709\u63d0\u4f9b\u4e00\u500b\u76f8\u7576\u65bc\u7121\u7dda\u7248\u300c\u5e8f\u5217\u57e0\u76e3\u6e2c\u8996\u7a97\u300d\u7684<strong>WiFi Console\uff08WiFi\u63a7\u5236\u53f0\uff09<\/strong>\u3002<\/p>\n<p>\u5728WIFI\u8a2d\u5b9a\u756b\u9762\uff0c\u8a2d\u5b9a\u8b93\u7121\u7dda\u7db2\u8def\u9023\u63a5\u5230\u5bb6\u88e1\u7684\u7121\u7dda\u8def\u7531\u5668\u4e4b\u5f8c\uff0c\u518d\u6309\u4e0b\u53f3\u4e0a\u89d2\u7684<strong>SWITCH TO STA MODE\uff08\u5207\u63db\u5230\u9023\u7dda\u7d42\u7aef\u6a21\u5f0f\uff09<\/strong>\uff0c\u8a73\u7d30\u7684\u64cd\u4f5c\u8aaa\u660e\u53ef\u53c3\u95b1arduino.org\u7db2\u7ad9\u7684<a href=\"http:\/\/www.arduino.org\/learning\/getting-started\/getting-started-with-arduino-uno-wifi\" target=\"_blank\">Getting started with Arduino UNO WiFi<\/a>\u3002<\/p>\n<p>\u8a2d\u5b9a\u6210STA\u6a21\u5f0f\uff0cUNO WiFi\u677f\u4fbf\u5931\u53bb\u7121\u7dda\u57fa\u5730\u53f0\uff08AP\uff09\u7684\u80fd\u529b\uff0c\u4f46\u4ecd\u5177\u5099\u7db2\u8def\u9023\u7dda\u529f\u80fd\u3002\u9023\u63a5UNO WiFi\u677f\u7684\u96fb\u8166\uff0c\u5fc5\u9808\u548c\u5b83\u9023\u7dda\u5230\u76f8\u540c\u7684\u7121\u7dda\u7db2\u8def\u74b0\u5883\u3002UNO WiFi\u677f\u9810\u8a2d\u7684\u4e3b\u6a5f\u540d\u7a31\u662f&#8220;arduino&#8221;\uff0c\u900f\u904e&#8220;arduino.local&#8221;\u7db2\u5740\uff0c\u5373\u53ef\u958b\u555f\u5b83\u7684\u7db2\u8def\u8a2d\u5b9a\u9801\u9762\uff1a<\/p>\n<p>http:\/\/arduino.local\/<\/p>\n<h2>\u4f7f\u7528Arduino IDE 1.7.10\u7248\u64b0\u5beb\u7a0b\u5f0f<\/h2>\n<p>Arduino UNO WiFi\u63a7\u5236\u677f\u662fArduino S.R.L\u516c\u53f8\u7684\u7522\u54c1\uff0c\u8acb\u4f7f\u7528\u8a72\u516c\u53f8\u7684<a href=\"http:\/\/www.arduino.org\/downloads\" target=\"_blank\">\u65b0\u7248Arduino IDE\uff08\u76ee\u524d\u662f1.7.10\u7248\uff09<\/a>\u4f86\u7de8\u5beb\u7a0b\u5f0f\u3002Arduino S.R.L\u516c\u53f8\u7684Jeff\u544a\u77e5\uff0c\u5728\u4eca\u5e74\u4e94\u6708\u820a\u91d1\u5c71Maker Faire\u6703\u5c55\u4e2d\uff0c\u8a72\u516c\u53f8\u5ba3\u4f48\u8a08\u5283\u672a\u4f86\u6703\u900f\u904eadd-on platform packages\uff08\u5916\u639b\u5e73\u53f0\u5957\u4ef6\uff09\u4f86\u652f\u63f4arduino.cc\u7684Arduino IDE\uff0c\u6e1b\u5c11\u958b\u767c\u8005\u4f7f\u7528Arduino IDE\u7684\u56f0\u64fe\u3002<\/p>\n<p>\u5148\u5728IDE\u4e3b\u529f\u80fd\u8868\u7684\u300c<strong>\u5de5\u5177&#8594;\u677f\u5b50<\/strong>\u300d\u9078\u64c7Arduino Uno WiFi\u677f\uff0c\u518d\u5f9e\u300c<strong>\u5de5\u5177&#8594;\u5e8f\u5217\u57e0<\/strong>\u300d\u9078\u64c7<strong>\u6709\u7dda\u5e8f\u5217\u57e0<\/strong>\uff08\u5982\u4e0b\u5716\u4e2d\u7684COM5\uff09\uff0c\u6216\u8005<strong>\u7db2\u8def\u57e0<\/strong>\uff08\u5982\u4e0b\u5716\u4e2d\u7684arduino at 192.168.7.185\uff09\u3002<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/arduino_ide_wifi.png\" width=\"651\" height=\"498\" alt=\"\u4f7f\u7528Arduino IDE 1.7.10\u7248\u64b0\u5beb\u7a0b\u5f0f\"\/><\/p>\n<p>\u9019\u9805\u300c\u7db2\u8def\u57e0\u300d\u9023\u7dda\u529f\u80fd\uff0c\u53ef\u8b93\u958b\u767c\u4eba\u54e1\u5728\u9060\u7aef\u66f4\u65b0Arduino\u63a7\u5236\u677f\u7684\u8edf\u9ad4\u3002<\/p>\n<h2>Arduino UNO WiFi\u7db2\u8def\u7a0b\u5f0f\u5165\u9580<\/h2>\n<p>\u4ee5\u5f80\uff0cArduino\u90fd\u662f\u900f\u904e\u4e59\u592a\u7db2\u8def\u6216\u8005Wi-Fi\u7121\u7dda\u7db2\u8def\u64f4\u5c55\u677f\uff08\u50cfArduino\u5b98\u7db2\u7684\u9019\u4e00\u6b3e<a href=\"http:\/\/www.arduino.org\/products\/shields\/arduino-wifi-shield\" target=\"_blank\">WiFi Shield<\/a>\uff09\u9023\u63a5\u7db2\u969b\u7db2\u8def\uff0c\u9019\u5169\u7a2e\u65b9\u6848\u90fd\u4f7f\u7528SPI\u4ecb\u9762\u8207Arduino\u63a7\u5236\u677f\u76f8\u9023\u3002<\/p>\n<p><strong>Arduino UNO WiFi\u677f\u7684ESP8266\u6676\u7247\u5247\u662f\u7d93\u7531I<sup>2<\/sup>C\u9023\u63a5Arduino\u5fae\u63a7\u5668<\/strong>\uff0c\u52a0\u4e0a\u6bcf\u500b\u7db2\u8def\u6676\u7247\u7684\u63a7\u5236\u65b9\u5f0f\u90fd\u4e0d\u4e00\u6a23\uff0c\u6240\u4ee5UNO WiFi\u677f\u7684\u7db2\u8def\u7a0b\u5f0f\u4e5f\u4e0d\u540c\u65bc\u4e59\u592a\u7db2\u8def\u7a0b\u5f0f\uff1b\u82e5\u4e0d\u4f7f\u7528Wi-Fi\u7db2\u8def\u529f\u80fd\uff0c\u9019\u584a\u677f\u5b50\u7684\u7a0b\u5f0f\u8a2d\u8a08\u65b9\u5f0f\u548c\u666e\u901a\u7684UNO\u76f8\u540c\u3002<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/ethernet_vs_wifi_library.png\" width=\"501\" height=\"245\" alt=\"\u4e59\u592a\u7db2\u8def\u4ee5\u53caUNO WiFi\u7684\u9023\u63a5\u65b9\u5f0f\"\/><\/p>\n<p>\u5728\u9023\u63a5\u4e59\u592a\u7db2\u8def\u6a21\u7d44\u7684\u60c5\u6cc1\u4e0b\uff0cArduino UNO\u677f\u7684\u6578\u4f4d10\uff5e13\u8173\u7121\u6cd5\u632a\u4f5c\u4ed6\u7528\uff1bArduino UNO WiFi\u5247\u662f\u72a7\u7272\u4e86A4\u548cA5\u5169\u500b\u985e\u6bd4\u8173\u3002<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/Federico_Musto.jpg\" width=\"600\" height=\"523\" alt=\"Arduino S.R.L\u516c\u53f8\uff08arduino.org\uff09\u5275\u8fa6\u4ebaFederico Musto\u5148\u751f\"\/><\/p>\n<p>\u5e95\u4e0b\u7684\u7a0b\u5f0f\u5c07\u4f7f\u7528Arduino IDE\u5167\u5efa\u7684WebSever\uff08\u7db2\u7ad9\u4f3a\u670d\u5668\uff09\u7bc4\u4f8b\uff0c\u8aaa\u660eUNO WiFi\u677f\u7684\u7a0b\u5f0f\u67b6\u69cb\u3002\u4e0a\u50b3\u6b64\u7a0b\u5f0f\u78bc\u4e4b\u5f8c\uff0c\u4f7f\u7528\u8005\u5c07\u80fd\u900f\u904e\u5e95\u4e0b\u7684\u7db2\u5740\u8b80\u53d6UNO WiFi\u677f\u7684\u81ea\u88fd\u7db2\u7ad9\uff1a<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/wifi_server_url.png\" width=\"340\" height=\"103\" alt=\"\u8b80\u53d6UNO WiFi\u677f\u7684\u81ea\u88fd\u7db2\u7ad9\u7684URL\u7db2\u5740\"\/><\/p>\n<p>\u6211\u5011\u81ea\u8a02\u7684\u7db2\u8def\u7a0b\u5f0f\u8def\u5f91\uff0c\u59cb\u7d42\u88ab\u9644\u52a0\u5728arduino.local\/arduino\/\u5f8c\u9762\u3002\u5e95\u4e0b\u662fWiFi\u7db2\u7ad9\u4f3a\u670d\u5668\u7a0b\u5f0f\u7684\u67b6\u69cb\uff0c\u7531\u65bc\u7121\u7dda\u7db2\u8def\u7684IP\u3001\u9598\u9053\u5668\uff08gateway\uff09\u4f4d\u5740&#8230;\u7b49\u53c3\u6578\uff0c\u90fd\u662f\u900f\u904e\u700f\u89bd\u5668\u8a2d\u7f6e\uff0c\u6240\u4ee5\u6211\u5011\u7684\u7a0b\u5f0f\u78bc\u88e1\u9762\u4e0d\u9700\u8981\u8a2d\u5b9a\uff1a<\/p>\n<p align=\"center\"><img decoding=\"async\" loading=\"lazy\" src=\"\/images\/hardware\/arduino\/wifi\/wifi_code_structure.png\" width=\"538\" height=\"525\" alt=\"WiFi\u7db2\u7ad9\u4f3a\u670d\u5668\u7a0b\u5f0f\u7684\u67b6\u69cb\"\/><\/p>\n<p>\u5176\u4e2d\u8ca0\u8cac\u8655\u7406\u524d\u7aef\u8cc7\u6599\u7684WiFiData\u985e\u578b\uff0c\u5b9a\u7fa9\u5728ArduinoWiFi\u7a0b\u5f0f\u5eab\u8cc7\u6599\u593e\u88e1\u7684SC16IS750.h\u6a94\u6848\u4e2d\u3002\u6bcf\u7576\u6709\u7528\u6236\u9023\u63a5\u6b64\u63a7\u5236\u677f\u6642\uff0cprocess()\u81ea\u8a02\u51fd\u5f0f\u5c07\u8b80\u53d6URL\u7db2\u5740\u6700\u5f8c\u9762\u7684\u53c3\u6578\uff0c\u5176\u503c\u82e5\u662f&#8220;webserver&#8221;\uff0c\u5247\u547c\u53ebWebServer()\u81ea\u8a02\u51fd\u5f0f\u8f38\u51fa\u7db2\u9801\uff0c\u82e5\u975e&#8220;webserver&#8221;\uff0cESP8266\u6703\u81ea\u884c\u5728\u7db2\u9801\u4e0a\u8f38\u51fa&#8220;Not found.&#8221;\uff08\u67e5\u7121\u6b64\u8cc7\u6e90\uff09\u3002<\/p>\n<p>\u4fee\u6539\u81eaArduino IDE\u5167\u5efa\u7684WebSever\uff08\u7db2\u7ad9\u4f3a\u670d\u5668\uff09\u7bc4\u4f8b\u7684\u5b8c\u6574\u7a0b\u5f0f\u78bc\u5982\u4e0b\uff1a<\/p>\n<pre>\r\n#include &lt;Wire.h&gt;\r\n#include &lt;ArduinoWiFi.h&gt;\r\n\/*\r\n  \u958b\u555f\u700f\u89bd\u5668\uff0c\u8f38\u5165\u6b64\u7db2\u5740\uff1a\r\n  http:\/\/&lt;IP&gt;\/arduino\/webserver\/\r\n  \u6216\u8005\r\n  http:\/\/&lt;hostname&gt;.local\/arduino\/webserver\/\r\n\r\n  \u76f8\u95dc\u8aaa\u660e\u8acb\u53c3\u95b1\uff1a\r\n  http:\/\/labs.arduino.org\/WebServer\r\n*\/\r\n\r\nvoid setup() {\r\n  Wifi.begin();\r\n  Wifi.println(\"WebServer Server is up\");  \/\/ \u8f38\u51fa\u8a0a\u606f\u5230\uff08\u7db2\u9801\u7684\uff09WiFi\u63a7\u5236\u53f0\r\n}\r\n\r\nvoid loop() {\r\n  while (Wifi.available()) {\r\n    process(Wifi);\r\n  }\r\n  delay(50);\r\n}\r\nvoid process(WifiData client) {\r\n  \/\/ \u8b80\u53d6\u547d\u4ee4\r\n  String command = client.readStringUntil('\/');\r\n\r\n  if (command == \"webserver\") {\r\n    WebServer(client);\r\n  }\r\n}\r\nvoid WebServer(WifiData client) {\r\n  client.println(\"HTTP\/1.1 200 OK\");\r\n  client.println(\"Content-Type: text\/html\");\r\n  client.println(\"Refresh: 5\");  \/\/ \u6bcf5\u79d2\u81ea\u52d5\u66f4\u65b0\uff08\u91cd\u65b0\u6574\u7406\uff09\u7db2\u9801\r\n  client.println();\r\n  client.println(\"&lt;html&gt;\");\r\n  client.println(\"&lt;head&gt; &lt;meta charset=\\\"utf-8\\\"&gt;&lt;title&gt;UNO WIFI\u7269\u806f\u7db2&lt;\/title&gt; &lt;\/head&gt;\");\r\n  client.print(\"&lt;body&gt;\");\r\n\r\n  for (int analogChannel = 0; analogChannel &lt; 4; analogChannel++) {\r\n    int sensorReading = analogRead(analogChannel);\r\n    client.print(\"\u985e\u6bd4\u8f38\u5165 \");\r\n    client.print(analogChannel);\r\n    client.print(\" \u7684\u503c\u70ba \");\r\n    client.print(sensorReading);\r\n    client.print(\"&lt;br\/&gt;\");\r\n  }\r\n\r\n  client.print(\"&lt;\/body&gt;\");\r\n  client.println(\"&lt;\/html&gt;\");\r\n  client.print(DELIMITER); \/\/ \u4e2d\u65b7\u8207\u7528\u6236\u7684\u9023\u7dda\r\n}\r\n<\/pre>\n<p>\u4e59\u592a\u7db2\u8def\u548cWiFi\u64f4\u5c55\u677f\u7a0b\u5f0f\uff0c\u90fd\u662f\u900f\u904e\u5e95\u4e0b\u7684\u8a9e\u6cd5\u4e2d\u65b7\u7528\u6236\u7aef\u7684\u9023\u7dda\uff1a<\/p>\n<p>client.stop();<\/p>\n<p>UNO WiFi\u63a7\u5236\u677f\u5247\u662f\u900f\u904e\u9019\u500b\u6558\u8ff0\u4e2d\u65b7\u9023\u7dda\uff0c\u5176\u4e2d\u7684DELIMITER\u5e38\u6578\u4e5f\u662f\u5b9a\u7fa9\u5728SC16IS750.h\u6a94\u6848\u88e1\u9762\uff1a<\/p>\n<p>client.print(DELIMITER);<\/p>\n<h2>\u5ef6\u4f38\u95b1\u8b80<\/h2>\n<ul>\n<li><a href=\"\/?p=865\" target=\"_blank\">Arduino\u50b3\u5947\u6545\u4e8b\uff1a\u958b\u767c\u79d8\u8f9b<\/a><\/li>\n<li><a href=\"\/?p=630\" target=\"_blank\">Arduino\u7db2\u8def\u9060\u7aef\u9059\u63a7\u5bb6\u96fb\u958b\u95dc\uff08\u4e00\uff09<\/a><\/li>\n<li><a href=\"\/?p=569\" target=\"_blank\">Arduino UNO\u63a7\u5236\u677f\u7c21\u4ecb<\/a><\/li>\n<li><a href=\"\/?p=551\" target=\"_blank\">Arduino Y\u00fan Mini\uff1a\u6539\u9020TL-WR703N\u6574\u5408\u81ea\u88fdArduino\u677f<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u5f35\u63a7\u5236\u677f\u7684\u5c3a\u5bf8\u548cUNO\u4e00\u6a23\uff0c\u677f\u5b50\u4e0a\u6574\u5408\u4e86Arduino UNO\u548cESP8266\uff08\u5177\u5099Wi-Fi\u7db2\u8def\u9023\u7dda\u7684\u7cfb\u7d71\u7d1a\u6676\u7247\uff09\u3002\u5b83\u63a1\u7528ATmega328\u5fae\u63a7\u5668\u57f7\u884cArduino\u7a0b\u5f0f\uff0c\u4e26\u4e14\u540c\u6a23\u63a1\u7528ATmega16U2\u4f5c\u70baUSB\u5e8f\u5217\u57e0\u901a\u8a0a\u6676\u7247\u3002\u63a7\u5236\u677f\u4e0a\u768416M bit\uff082MB\uff09\u5feb\u9583\u8a18\u61b6\u9ad4\uff0c\u7528\u65bc\u5132\u5b58ESP8266\u7684\u97cc\u9ad4\uff0c\u6b64\u7db2\u8def\u6676\u7247\u7684\u9810\u8a2d\u5de5\u4f5c\u6a21\u5f0f\u70baAP+STA\uff0c\u4e5f\u5c31\u662f\u540c\u6642\u5145\u7576\u7db2\u8def\u57fa\u5730\u53f0\uff08Access Point\uff09\u548c\u7121\u7dda\u7d42\u7aef\u8a2d\u5099\uff08Station\uff09\u3002<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"\/images\/hardware\/arduino\/wifi\/arduino_uno_wifi.png\" width=\"546\" height=\"372\" alt=\"Arduino UNO WiFi\u63a7\u5236\u677f\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[15],"tags":[32],"class_list":["post-884","post","type-post","status-publish","format-standard","hentry","category-diy","tag-arduino"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Arduino UNO WiFi = Arduino UNO\u677f + ESP8266 - \u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/swf.com.tw\/?p=884\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005:\" \/>\n\t<meta name=\"twitter:data1\" content=\"cubie\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9810\u4f30\u95b1\u8b80\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\u9418\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=884#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=884\"},\"author\":{\"name\":\"cubie\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#\\\/schema\\\/person\\\/24480fda9184aa137df8f05d79bc2f57\"},\"headline\":\"Arduino UNO WiFi = Arduino UNO\u677f + ESP8266\",\"datePublished\":\"2016-06-15T09:04:28+00:00\",\"dateModified\":\"2016-06-16T15:59:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=884\"},\"wordCount\":245,\"commentCount\":126,\"publisher\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#organization\"},\"keywords\":[\"arduino\"],\"articleSection\":[\"\u786c\u9ad4\u8207DIY\"],\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/swf.com.tw\\\/?p=884#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=884\",\"url\":\"https:\\\/\\\/swf.com.tw\\\/?p=884\",\"name\":\"Arduino UNO WiFi = Arduino UNO\u677f + ESP8266 - \u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#website\"},\"datePublished\":\"2016-06-15T09:04:28+00:00\",\"dateModified\":\"2016-06-16T15:59:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=884#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/swf.com.tw\\\/?p=884\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/?p=884#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/swf.com.tw\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Arduino UNO WiFi = Arduino UNO\u677f + ESP8266\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#website\",\"url\":\"https:\\\/\\\/swf.com.tw\\\/\",\"name\":\"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8\",\"description\":\"Arduino+Python+JavaScript+\u7a0b\u5f0f\u8a2d\u8a08+\u786c\u9ad4DIY\",\"publisher\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/swf.com.tw\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#organization\",\"name\":\"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8\",\"url\":\"https:\\\/\\\/swf.com.tw\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/swf.com.tw\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/logo_bat.png\",\"contentUrl\":\"https:\\\/\\\/swf.com.tw\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/logo_bat.png\",\"width\":71,\"height\":65,\"caption\":\"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8\"},\"image\":{\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/swf.com.tw\\\/#\\\/schema\\\/person\\\/24480fda9184aa137df8f05d79bc2f57\",\"name\":\"cubie\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g\",\"caption\":\"cubie\"},\"sameAs\":[\"https:\\\/\\\/swf.com.tw\"],\"url\":\"https:\\\/\\\/swf.com.tw\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Arduino UNO WiFi = Arduino UNO\u677f + ESP8266 - \u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/swf.com.tw\/?p=884","twitter_misc":{"\u4f5c\u8005:":"cubie","\u9810\u4f30\u95b1\u8b80\u6642\u9593":"2 \u5206\u9418"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/swf.com.tw\/?p=884#article","isPartOf":{"@id":"https:\/\/swf.com.tw\/?p=884"},"author":{"name":"cubie","@id":"https:\/\/swf.com.tw\/#\/schema\/person\/24480fda9184aa137df8f05d79bc2f57"},"headline":"Arduino UNO WiFi = Arduino UNO\u677f + ESP8266","datePublished":"2016-06-15T09:04:28+00:00","dateModified":"2016-06-16T15:59:53+00:00","mainEntityOfPage":{"@id":"https:\/\/swf.com.tw\/?p=884"},"wordCount":245,"commentCount":126,"publisher":{"@id":"https:\/\/swf.com.tw\/#organization"},"keywords":["arduino"],"articleSection":["\u786c\u9ad4\u8207DIY"],"inLanguage":"zh-TW","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/swf.com.tw\/?p=884#respond"]}]},{"@type":"WebPage","@id":"https:\/\/swf.com.tw\/?p=884","url":"https:\/\/swf.com.tw\/?p=884","name":"Arduino UNO WiFi = Arduino UNO\u677f + ESP8266 - \u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8","isPartOf":{"@id":"https:\/\/swf.com.tw\/#website"},"datePublished":"2016-06-15T09:04:28+00:00","dateModified":"2016-06-16T15:59:53+00:00","breadcrumb":{"@id":"https:\/\/swf.com.tw\/?p=884#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/swf.com.tw\/?p=884"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/swf.com.tw\/?p=884#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/swf.com.tw\/"},{"@type":"ListItem","position":2,"name":"Arduino UNO WiFi = Arduino UNO\u677f + ESP8266"}]},{"@type":"WebSite","@id":"https:\/\/swf.com.tw\/#website","url":"https:\/\/swf.com.tw\/","name":"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8","description":"Arduino+Python+JavaScript+\u7a0b\u5f0f\u8a2d\u8a08+\u786c\u9ad4DIY","publisher":{"@id":"https:\/\/swf.com.tw\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/swf.com.tw\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":"Organization","@id":"https:\/\/swf.com.tw\/#organization","name":"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8","url":"https:\/\/swf.com.tw\/","logo":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/swf.com.tw\/#\/schema\/logo\/image\/","url":"https:\/\/swf.com.tw\/wp-content\/uploads\/2019\/10\/logo_bat.png","contentUrl":"https:\/\/swf.com.tw\/wp-content\/uploads\/2019\/10\/logo_bat.png","width":71,"height":65,"caption":"\u8d85\u5716\u89e3\u7cfb\u5217\u5716\u66f8"},"image":{"@id":"https:\/\/swf.com.tw\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/swf.com.tw\/#\/schema\/person\/24480fda9184aa137df8f05d79bc2f57","name":"cubie","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/secure.gravatar.com\/avatar\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c77b6f4d3b4ccdcdc343aeee53301c212f54787c43bd2ebf6648bf74ff59b474?s=96&d=retro&r=g","caption":"cubie"},"sameAs":["https:\/\/swf.com.tw"],"url":"https:\/\/swf.com.tw\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swf.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=884"}],"version-history":[{"count":0,"href":"https:\/\/swf.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/884\/revisions"}],"wp:attachment":[{"href":"https:\/\/swf.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swf.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swf.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}