{"id":445929,"date":"2025-01-23T15:00:38","date_gmt":"2025-01-23T15:00:38","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=445929"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=445929","title":{"rendered":"<span>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Lolin NodeMCU \u0438 Elbear ace-uno. \u041f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/51d\/01c\/0bb\/51d01c0bb7e6d05d6412442355ac77e7.jpg\" alt=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b\" title=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b\" width=\"1056\" height=\"665\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/51d\/01c\/0bb\/51d01c0bb7e6d05d6412442355ac77e7.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b<\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Lolin NodeMCU \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 ESP8266. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0430\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<p><strong>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/strong><\/p>\n<ol>\n<li>\n<p>Lolin NodeMCU &#8212; \u044d\u0442\u043e \u043f\u043b\u0430\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 ESP8266, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 Wi-Fi \u0438 \u043f\u0440\u043e\u0441\u0442\u0430 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 &#8212; \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 &#8212; \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Wi-Fi \u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 ESP8266WiFi.h \u0438 ESP8266WebServer.h.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<ol>\n<li>\n<p>Lolin NodeMCU RX \u2013 TX Elbear ace-uno<\/p>\n<\/li>\n<li>\n<p>Lolin NodeMCU TX \u2013 RX Elbear ace-uno<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438<\/strong><\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435 \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b Wi-Fi, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a SSID \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 IP-\u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<pre><code>const char* ssid = \"\u0438\u043c\u044f\"; const char* password = \"\u043f\u0430\u0440\u043e\u043b\u044c\"; IPAddress local_IP(192, 168, 1, 3);\u00a0 \/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 IP IPAddress gateway(192, 168, 1, 1);\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ \u0428\u043b\u044e\u0437 (\u043e\u0431\u044b\u0447\u043d\u043e IP \u0432\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u0430) IPAddress subnet(255, 255, 255, 0);\u00a0\u00a0\u00a0\u00a0 \/\/ \u041f\u043e\u0434\u0441\u0435\u0442\u044c<\/code><\/pre>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0442\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 80. \u041c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u043e\u043c\u0430\u043d\u0434, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<pre><code>ESP8266WebServer server(80); void setup() { \u00a0\u00a0\u00a0 Serial.begin(9600); \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u00a0\u00a0\u00a0 WiFi.mode(WIFI_AP_STA); \/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 AP \u0438 \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u00a0\u00a0\u00a0 WiFi.config(local_IP, gateway, subnet); \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e IP \u00a0\u00a0\u00a0 WiFi.begin(ssid, password); \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Wi-Fi \u0441\u0435\u0442\u0438 \u00a0\u00a0\u00a0 \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a Wi-Fi \u00a0\u00a0\u00a0 while (WiFi.status() != WL_CONNECTED) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 delay(1000); \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u00a0\u00a0\u00a0 WiFi.softAP(\"ESP8266_AP\", \"password\"); \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0441 SSID \u0438 \u043f\u0430\u0440\u043e\u043b\u0435\u043c \u00a0\u00a0\u00a0 \/\/ \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u00a0\u00a0\u00a0 server.on(\"\/\", handleRoot); \u00a0\u00a0\u00a0 server.on(\"\/sendCommand\", handleSendCommand); \u00a0\u00a0\u00a0 server.on(\"\/sendSerialInput\", handleSendSerialInput); \u00a0\u00a0\u00a0 server.begin(); }<\/code><\/pre>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434<\/strong><\/p>\n<p>\u0412\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u0430\u043d\u0434\u044b `LED_ON` \u0438 `LED_OFF` \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434. \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `processCommand`, \u0433\u0434\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0436\u0443\u0440\u043d\u0430\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<pre><code>void processCommand(String command) { \u00a0\u00a0\u00a0 Serial.println(\"Processing command: \" + command); \/\/ \u041e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u00a0\u00a0\u00a0 Serial.print(command); \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u00a0\u00a0\u00a0 if (command == \"LED_ON\") { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 digitalWrite(LED_BUILTIN, HIGH); \/\/ \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Serial.println(\"LED is ON\"); \/\/ \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 storeCommand(\"LED ON\"); \u00a0\u00a0\u00a0 } else if (command == \"LED_OFF\") { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 digitalWrite(LED_BUILTIN, LOW); \/\/ \u0412\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Serial.println(\"LED is OFF\"); \/\/ \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 storeCommand(\"LED OFF\"); \u00a0\u00a0\u00a0 } else { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Serial.println(\"Unknown command received: \" + command); \/\/ \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u00a0\u00a0\u00a0 } }<\/code><\/pre>\n<p><strong>\u0412\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/strong><\/p>\n<p>\u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `handleRoot` \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c.<\/p>\n<pre><code>void handleRoot() { \u00a0\u00a0\u00a0 String html = \"&lt;html&gt;&lt;body&gt;&lt;h1&gt;\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 Elbear ACE-UNO&lt;\/h1&gt;\"; \u00a0\u00a0\u00a0 html += \"&lt;form action=\\\"\/sendCommand\\\" method=\\\"POST\\\"&gt;\"; \u00a0\u00a0\u00a0 html += \"&lt;input type=\\\"text\\\" name=\\\"command\\\" placeholder=\\\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443\\\"&gt;\"; \u00a0\u00a0\u00a0 html += \"&lt;input type=\\\"submit\\\" value=\\\"\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443\\\"&gt;\"; \u00a0\u00a0\u00a0 html += \"&lt;\/form&gt;\"; \u00a0\u00a0\u00a0 \/\/ \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 5 \u043a\u043e\u043c\u0430\u043d\u0434 \u00a0\u00a0\u00a0 html += \"&lt;h2&gt;\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:&lt;\/h2&gt;&lt;ul&gt;\"; \u00a0\u00a0\u00a0 for (int i = 0; i &lt; 5; i++) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (lastCommands[i] != \"\") { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 html += \"&lt;li&gt;\" + lastCommands[i] + \"&lt;\/li&gt;\"; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 html += \"&lt;\/ul&gt;\"; \u00a0\u00a0\u00a0 \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 HTML-\u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u00a0\u00a0\u00a0 server.send(200, \"text\/html\", html); }<\/code><\/pre>\n<p>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/p>\n<p><strong>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 Lolin NodeMCU<\/strong><\/p>\n<pre><code>#include &lt;ESP8266WiFi.h&gt; #include &lt;ESP8266WebServer.h&gt;  const char* ssid = \"\u0438\u043c\u044f\"; const char* password = \"\u043f\u0430\u0440\u043e\u043b\u044c\";  \/\/ Static IP and network settings IPAddress local_IP(192, 168, 1, 3);  \/\/ Set your desired static IP IPAddress gateway(192, 168, 1, 1);      \/\/ Gateway (usually the IP of your router) IPAddress subnet(255, 255, 255, 0);     \/\/ Subnet  ESP8266WebServer server(80); String lastCommands[5]; \/\/ Array to store the last 5 commands int commandIndex = 0;   \/\/ Index for adding new commands String serialOutput;     \/\/ String to store serial output  void setup() {   Serial.begin(9600);   \/\/ Set up the serial port for communication with Elbear ACE-UNO    \/\/ Set up Wi-Fi in client mode   WiFi.mode(WIFI_AP_STA); \/\/ Set to AP and station mode   WiFi.config(local_IP, gateway, subnet); \/\/ Set static IP   WiFi.begin(ssid, password); \/\/ Connect to Wi-Fi network    \/\/ Check for Wi-Fi connection   while (WiFi.status() != WL_CONNECTED) {     delay(1000);   }    \/\/ Set up access point   WiFi.softAP(\"ESP8266_AP\", \"password\"); \/\/ Create access point with SSID and password    \/\/ Register routes   server.on(\"\/\", handleRoot);   server.on(\"\/sendCommand\", handleSendCommand); \/\/ Route to send custom command   server.on(\"\/sendSerialInput\", handleSendSerialInput); \/\/ Route to send serial input   server.begin(); }  void loop() { server.handleClient(); }  void processCommand(String command) {   Serial.println(\"Processing command: \" + command); \/\/ Debug message for command processing    \/\/ Send command to the other device via Serial   Serial.print(command); \/\/ Send the command to the other device   Serial.println(); \/\/ Add newline to separate commands    if (command == \"LED_ON\") {     digitalWrite(LED_BUILTIN, HIGH); \/\/ Turn on LED     Serial.println(\"LED is ON\"); \/\/ Confirmation message     storeCommand(\"LED ON\");   } else if (command == \"LED_OFF\") {     digitalWrite(LED_BUILTIN, LOW); \/\/ Turn off LED     Serial.println(\"LED is OFF\"); \/\/ Confirmation message     storeCommand(\"LED OFF\");   } else {     Serial.println(\"Unknown command received: \" + command); \/\/ Unknown command message   } }  void handleRoot() {   String html = \"&lt;html&gt;&lt;body&gt;&lt;h1&gt;Send Custom Command to Elbear ACE-UNO&lt;\/h1&gt;\";      \/\/ Form to send custom command   html += \"&lt;form action=\\\"\/sendCommand\\\" method=\\\"POST\\\"&gt;\";   html += \"&lt;input type=\\\"text\\\" name=\\\"command\\\" placeholder=\\\"Enter command\\\"&gt;\";   html += \"&lt;input type=\\\"submit\\\" value=\\\"Send Command\\\"&gt;\";   html += \"&lt;\/form&gt;\";    \/\/ Input for serialInput   html += \"&lt;h2&gt;Serial Input:&lt;\/h2&gt;\";   html += \"&lt;form action=\\\"\/sendSerialInput\\\" method=\\\"POST\\\"&gt;\";   html += \"&lt;input type=\\\"text\\\" name=\\\"serialInput\\\" placeholder=\\\"Enter serial command\\\"&gt;\";   html += \"&lt;input type=\\\"submit\\\" value=\\\"Send Serial Command\\\"&gt;\";   html += \"&lt;\/form&gt;\";    \/\/ Display the last 5 commands   html += \"&lt;h2&gt;Last Commands:&lt;\/h2&gt;&lt;ul&gt;\";   for (int i = 0; i &lt; 5; i++) {     if (lastCommands[i] != \"\") { \/\/ Check if there is a command       html += \"&lt;li&gt;\" + lastCommands[i] + \"&lt;\/li&gt;\";     }   }   html += \"&lt;\/ul&gt;\";    \/\/ Display serial output   html += \"&lt;h2&gt;Serial Output:&lt;\/h2&gt;&lt;div&gt;\" + serialOutput + \"&lt;\/div&gt;\";    \/\/ Display connected devices   html += \"&lt;h2&gt;Connected Devices:&lt;\/h2&gt;&lt;ul&gt;\";   int numDevices = WiFi.softAPgetStationNum(); \/\/ Get the number of connected devices   html += \"&lt;li&gt;Number of connected devices: \" + String(numDevices) + \"&lt;\/li&gt;\";      \/\/ Get information about connected devices   struct station_info *stationList = wifi_softap_get_station_info();   while (stationList != NULL) {     html += \"&lt;li&gt;Device MAC: \" + String(macToString(stationList-&gt;bssid)) + \"&lt;\/li&gt;\";     stationList = STAILQ_NEXT(stationList, next);   }   html += \"&lt;\/ul&gt;&lt;\/body&gt;&lt;\/html&gt;\";      server.send(200, \"text\/html\", html); }  void handleSendCommand() {   if (server.hasArg(\"command\")) {     String command = server.arg(\"command\"); \/\/ Get the command from the form     command.trim(); \/\/ Remove extra spaces     Serial.println(\"Command from web: \" + command); \/\/ Debug message     serialOutput += \"Command from web: \" + command + \"&lt;br&gt;\"; \/\/ Add to serial output for display     processCommand(command); \/\/ Process the command     server.send(200, \"text\/html\", \"&lt;html&gt;&lt;body&gt;&lt;h1&gt;Command sent: \" + command + \"&lt;\/h1&gt;&lt;a href=\\\"\/\\\"&gt;Go back&lt;\/a&gt;&lt;\/body&gt;&lt;\/html&gt;\");   } else {     server.send(400, \"text\/plain\", \"No command provided\");   } }  void handleSendSerialInput() {   if (server.hasArg(\"serialInput\")) {     String serialInput = server.arg(\"serialInput\"); \/\/ Get the serial input from the form     serialInput.trim(); \/\/ Remove extra spaces     Serial.println(\"Serial Input from web: \" + serialInput); \/\/ Send serial input to Serial     processCommand(serialInput); \/\/ Process the command     server.send(200, \"text\/html\", \"&lt;html&gt;&lt;body&gt;&lt;h1&gt;Serial command sent: \" + serialInput + \"&lt;\/h1&gt;&lt;a href=\\\"\/\\\"&gt;Go back&lt;\/a&gt;&lt;\/body&gt;&lt;\/html&gt;\");   } else {     server.send(400, \"text\/plain\", \"No serial command provided\");   } }  void storeCommand(String command) {   lastCommands[commandIndex] = command; \/\/ Store command in array   commandIndex = (commandIndex + 1) % 5; \/\/ Increment index, reset at 5 }  \/\/ Function to convert MAC address to string String macToString(uint8_t *mac) {   String macStr = \"\";   for (int i = 0; i &lt; 6; i++) {     macStr += String(mac[i], HEX);     if (i &lt; 5) macStr += \":\";   }   return macStr; } <\/code><\/pre>\n<p><strong>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 Elbear Ace-uno<\/strong><\/p>\n<pre><code>void setup() {   pinMode(LED_BUILTIN, OUTPUT); \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0438\u043d\u0430 \u043a\u0430\u043a \u0432\u044b\u0445\u043e\u0434   Serial.begin(9600); \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430   Serial.println(\"Ready to receive commands...\"); \/\/ \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 }  void loop() {   if (Serial.available()) {     String command = Serial.readStringUntil('\\n'); \/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b     command.trim(); \/\/ \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432     Serial.println(\"Received command: \" + command); \/\/ \u041e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     if (command == \"LED_ON\") {       digitalWrite(LED_BUILTIN, HIGH); \/\/ \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430       Serial.println(\"LED is ON\"); \/\/ \u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f     } else if (command == \"LED_OFF\") {       digitalWrite(LED_BUILTIN, LOW); \/\/ \u0412\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430       Serial.println(\"LED is OFF\"); \/\/ \u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f     } else {       Serial.println(\"Unknown command\"); \/\/ \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435     }   } } <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 <a href=\"https:\/\/t.me\/innatomeya_STM32_Linux\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0439 \u0422\u0413<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/875960\/\"> https:\/\/habr.com\/ru\/articles\/875960\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"bordered full-width\">\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b<\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Lolin NodeMCU \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 ESP8266. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0430\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<p><strong>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/strong><\/p>\n<ol>\n<li>\n<p>Lolin NodeMCU &#8212; \u044d\u0442\u043e \u043f\u043b\u0430\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 ESP8266, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 Wi-Fi \u0438 \u043f\u0440\u043e\u0441\u0442\u0430 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 &#8212; \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 &#8212; \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Wi-Fi \u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 ESP8266WiFi.h \u0438 ESP8266WebServer.h.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<ol>\n<li>\n<p>Lolin NodeMCU RX \u2013 TX Elbear ace-uno<\/p>\n<\/li>\n<li>\n<p>Lolin NodeMCU TX \u2013 RX Elbear ace-uno<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438<\/strong><\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435 \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b Wi-Fi, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a SSID \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 IP-\u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<pre><code>const char* ssid = \"\u0438\u043c\u044f\"; const char* password = \"\u043f\u0430\u0440\u043e\u043b\u044c\"; IPAddress local_IP(192, 168, 1, 3);\u00a0 \/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 IP IPAddress gateway(192, 168, 1, 1);\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ \u0428\u043b\u044e\u0437 (\u043e\u0431\u044b\u0447\u043d\u043e IP \u0432\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u0430) IPAddress subnet(255, 255, 255, 0);\u00a0\u00a0\u00a0\u00a0 \/\/ \u041f\u043e\u0434\u0441\u0435\u0442\u044c<\/code><\/pre>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0442\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 80. \u041c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u043e\u043c\u0430\u043d\u0434, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<pre><code>ESP8266WebServer server(80); void setup() { \u00a0\u00a0\u00a0 Serial.begin(9600); \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u00a0\u00a0\u00a0 WiFi.mode(WIFI_AP_STA); \/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 AP \u0438 \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u00a0\u00a0\u00a0 WiFi.config(local_IP, gateway, subnet); \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e IP \u00a0\u00a0\u00a0 WiFi.begin(ssid, password); \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Wi-Fi \u0441\u0435\u0442\u0438 \u00a0\u00a0\u00a0 \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a Wi-Fi \u00a0\u00a0\u00a0 while (WiFi.status() != WL_CONNECTED) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 delay(1000); \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u00a0\u00a0\u00a0 WiFi.softAP(\"ESP8266_AP\", \"password\"); \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0441 SSID \u0438 \u043f\u0430\u0440\u043e\u043b\u0435\u043c \u00a0\u00a0\u00a0 \/\/ \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u00a0\u00a0\u00a0 server.on(\"\/\", handleRoot); \u00a0\u00a0\u00a0 server.on(\"\/sendCommand\", handleSendCommand); \u00a0\u00a0\u00a0 server.on(\"\/sendSerialInput\", handleSendSerialInput); \u00a0\u00a0\u00a0 server.begin(); }<\/code><\/pre>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434<\/strong><\/p>\n<p>\u0412\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u0430\u043d\u0434\u044b `LED_ON` \u0438 `LED_OFF` \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434. \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `processCommand`, \u0433\u0434\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0436\u0443\u0440\u043d\u0430\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<pre><code>void processCommand(String command) { \u00a0\u00a0\u00a0 Serial.println(\"Processing command: \" + command); \/\/ \u041e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u00a0\u00a0\u00a0 Serial.print(command); \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u00a0\u00a0\u00a0 if (command == \"LED_ON\") { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 digitalWrite(LED_BUILTIN, HIGH); \/\/ \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Serial.println(\"LED is ON\"); \/\/ \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 storeCommand(\"LED ON\"); \u00a0\u00a0\u00a0 } else if (command == \"LED_OFF\") { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 digitalWrite(LED_BUILTIN, LOW); \/\/ \u0412\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Serial.println(\"LED is OFF\"); \/\/ \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 storeCommand(\"LED OFF\"); \u00a0\u00a0\u00a0 } else { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Serial.println(\"Unknown command received: \" + command); \/\/ \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u00a0\u00a0\u00a0 } }<\/code><\/pre>\n<p><strong>\u0412\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/strong><\/p>\n<p>\u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `handleRoot` \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c.<\/p>\n<pre><code>void handleRoot() { \u00a0\u00a0\u00a0 String html = \"&lt;html&gt;&lt;body&gt;&lt;h1&gt;\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 Elbear ACE-UNO&lt;\/h1&gt;\"; \u00a0\u00a0\u00a0 html += \"&lt;form action=\\\"\/sendCommand\\\" method=\\\"POST\\\"&gt;\"; \u00a0\u00a0\u00a0 html += \"&lt;input type=\\\"text\\\" name=\\\"command\\\" placeholder=\\\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443\\\"&gt;\"; \u00a0\u00a0\u00a0 html += \"&lt;input type=\\\"submit\\\" value=\\\"\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443\\\"&gt;\"; \u00a0\u00a0\u00a0 html += \"&lt;\/form&gt;\"; \u00a0\u00a0\u00a0 \/\/ \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 5 \u043a\u043e\u043c\u0430\u043d\u0434 \u00a0\u00a0\u00a0 html += \"&lt;h2&gt;\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:&lt;\/h2&gt;&lt;ul&gt;\"; \u00a0\u00a0\u00a0 for (int i = 0; i &lt; 5; i++) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (lastCommands[i] != \"\") { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 html += \"&lt;li&gt;\" + lastCommands[i] + \"&lt;\/li&gt;\"; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 html += \"&lt;\/ul&gt;\"; \u00a0\u00a0\u00a0 \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 HTML-\u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u00a0\u00a0\u00a0 server.send(200, \"text\/html\", html); }<\/code><\/pre>\n<p>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/p>\n<p><strong>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 Lolin NodeMCU<\/strong><\/p>\n<pre><code>#include &lt;ESP8266WiFi.h&gt; #include &lt;ESP8266WebServer.h&gt;  const char* ssid = \"\u0438\u043c\u044f\"; const char* password = \"\u043f\u0430\u0440\u043e\u043b\u044c\";  \/\/ Static IP and network settings IPAddress local_IP(192, 168, 1, 3);  \/\/ Set your desired static IP IPAddress gateway(192, 168, 1, 1);      \/\/ Gateway (usually the IP of your router) IPAddress subnet(255, 255, 255, 0);     \/\/ Subnet  ESP8266WebServer server(80); String lastCommands[5]; \/\/ Array to store the last 5 commands int commandIndex = 0;   \/\/ Index for adding new commands String serialOutput;     \/\/ String to store serial output  void setup() {   Serial.begin(9600);   \/\/ Set up the serial port for communication with Elbear ACE-UNO    \/\/ Set up Wi-Fi in client mode   WiFi.mode(WIFI_AP_STA); \/\/ Set to AP and station mode   WiFi.config(local_IP, gateway, subnet); \/\/ Set static IP   WiFi.begin(ssid, password); \/\/ Connect to Wi-Fi network    \/\/ Check for Wi-Fi connection   while (WiFi.status() != WL_CONNECTED) {     delay(1000);   }    \/\/ Set up access point   WiFi.softAP(\"ESP8266_AP\", \"password\"); \/\/ Create access point with SSID and password    \/\/ Register routes   server.on(\"\/\", handleRoot);   server.on(\"\/sendCommand\", handleSendCommand); \/\/ Route to send custom command   server.on(\"\/sendSerialInput\", handleSendSerialInput); \/\/ Route to send serial input   server.begin(); }  void loop() { server.handleClient(); }  void processCommand(String command) {   Serial.println(\"Processing command: \" + command); \/\/ Debug message for command processing    \/\/ Send command to the other device via Serial   Serial.print(command); \/\/ Send the command to the other device   Serial.println(); \/\/ Add newline to separate commands    if (command == \"LED_ON\") {     digitalWrite(LED_BUILTIN, HIGH); \/\/ Turn on LED     Serial.println(\"LED is ON\"); \/\/ Confirmation message     storeCommand(\"LED ON\");   } else if (command == \"LED_OFF\") {     digitalWrite(LED_BUILTIN, LOW); \/\/ Turn off LED     Serial.println(\"LED is OFF\"); \/\/ Confirmation message     storeCommand(\"LED OFF\");   } else {     Serial.println(\"Unknown command received: \" + command); \/\/ Unknown command message   } }  void handleRoot() {   String html = \"&lt;html&gt;&lt;body&gt;&lt;h1&gt;Send Custom Command to Elbear ACE-UNO&lt;\/h1&gt;\";      \/\/ Form to send custom command   html += \"&lt;form action=\\\"\/sendCommand\\\" method=\\\"POST\\\"&gt;\";   html += \"&lt;input type=\\\"text\\\" name=\\\"command\\\" placeholder=\\\"Enter command\\\"&gt;\";   html += \"&lt;input type=\\\"submit\\\" value=\\\"Send Command\\\"&gt;\";   html += \"&lt;\/form&gt;\";    \/\/ Input for serialInput   html += \"&lt;h2&gt;Serial Input:&lt;\/h2&gt;\";   html += \"&lt;form action=\\\"\/sendSerialInput\\\" method=\\\"POST\\\"&gt;\";   html += \"&lt;input type=\\\"text\\\" name=\\\"serialInput\\\" placeholder=\\\"Enter serial command\\\"&gt;\";   html += \"&lt;input type=\\\"submit\\\" value=\\\"Send Serial Command\\\"&gt;\";   html += \"&lt;\/form&gt;\";    \/\/ Display the last 5 commands   html += \"&lt;h2&gt;Last Commands:&lt;\/h2&gt;&lt;ul&gt;\";   for (int i = 0; i &lt; 5; i++) {     if (lastCommands[i] != \"\") { \/\/ Check if there is a command       html += \"&lt;li&gt;\" + lastCommands[i] + \"&lt;\/li&gt;\";     }   }   html += \"&lt;\/ul&gt;\";    \/\/ Display serial output   html += \"&lt;h2&gt;Serial Output:&lt;\/h2&gt;&lt;div&gt;\" + serialOutput + \"&lt;\/div&gt;\";    \/\/ Display connected devices   html += \"&lt;h2&gt;Connected Devices:&lt;\/h2&gt;&lt;ul&gt;\";   int numDevices = WiFi.softAPgetStationNum(); \/\/ Get the number of connected devices   html += \"&lt;li&gt;Number of connected devices: \" + String(numDevices) + \"&lt;\/li&gt;\";      \/\/ Get information about connected devices   struct station_info *stationList = wifi_softap_get_station_info();   while (stationList != NULL) {     html += \"&lt;li&gt;Device MAC: \" + String(macToString(stationList-&gt;bssid)) + \"&lt;\/li&gt;\";     stationList = STAILQ_NEXT(stationList, next);   }   html += \"&lt;\/ul&gt;&lt;\/body&gt;&lt;\/html&gt;\";      server.send(200, \"text\/html\", html); }  void handleSendCommand() {   if (server.hasArg(\"command\")) {     String command = server.arg(\"command\"); \/\/ Get the command from the form     command.trim(); \/\/ Remove extra spaces     Serial.println(\"Command from web: \" + command); \/\/ Debug message     serialOutput += \"Command from web: \" + command + \"&lt;br&gt;\"; \/\/ Add to serial output for display     processCommand(command); \/\/ Process the command     server.send(200, \"text\/html\", \"&lt;html&gt;&lt;body&gt;&lt;h1&gt;Command sent: \" + command + \"&lt;\/h1&gt;&lt;a href=\\\"\/\\\"&gt;Go back&lt;\/a&gt;&lt;\/body&gt;&lt;\/html&gt;\");   } else {     server.send(400, \"text\/plain\", \"No command provided\");   } }  void handleSendSerialInput() {   if (server.hasArg(\"serialInput\")) {     String serialInput = server.arg(\"serialInput\"); \/\/ Get the serial input from the form     serialInput.trim(); \/\/ Remove extra spaces     Serial.println(\"Serial Input from web: \" + serialInput); \/\/ Send serial input to Serial     processCommand(serialInput); \/\/ Process the command     server.send(200, \"text\/html\", \"&lt;html&gt;&lt;body&gt;&lt;h1&gt;Serial command sent: \" + serialInput + \"&lt;\/h1&gt;&lt;a href=\\\"\/\\\"&gt;Go back&lt;\/a&gt;&lt;\/body&gt;&lt;\/html&gt;\");   } else {     server.send(400, \"text\/plain\", \"No serial command provided\");   } }  void storeCommand(String command) {   lastCommands[commandIndex] = command; \/\/ Store command in array   commandIndex = (commandIndex + 1) % 5; \/\/ Increment index, reset at 5 }  \/\/ Function to convert MAC address to string String macToString(uint8_t *mac) {   String macStr = \"\";   for (int i = 0; i &lt; 6; i++) {     macStr += String(mac[i], HEX);     if (i &lt; 5) macStr += \":\";   }   return macStr; } <\/code><\/pre>\n<p><strong>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 Elbear Ace-uno<\/strong><\/p>\n<pre><code>void setup() {   pinMode(LED_BUILTIN, OUTPUT); \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0438\u043d\u0430 \u043a\u0430\u043a \u0432\u044b\u0445\u043e\u0434   Serial.begin(9600); \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430   Serial.println(\"Ready to receive commands...\"); \/\/ \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 }  void loop() {   if (Serial.available()) {     String command = Serial.readStringUntil('\\n'); \/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b     command.trim(); \/\/ \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432     Serial.println(\"Received command: \" + command); \/\/ \u041e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     if (command == \"LED_ON\") {       digitalWrite(LED_BUILTIN, HIGH); \/\/ \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430       Serial.println(\"LED is ON\"); \/\/ \u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-445929","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/445929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=445929"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/445929\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=445929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=445929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=445929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}