Всем привет. Может быть есть рабочий код, для "ESP8266 ESP-01/01S 5V WiFi Relay Module Things Smart Home Remote Control Switch Phone APP ESP01 ESP-01 Wireless WIFI Module" https://aliexpress.ru/item/32887538...earchweb0_0,searchweb201602_,searchweb201603_ - такой штуки??? Спасибо
Из первой же страницы поиска Код (Text): #include <ESP8266WiFi.h> const char* ssid = "Ваша сеть";//type your ssid const char* password = "Ваш пароль";//type your password int relayPin = 0; // GPIO0 of ESP8266 WiFiServer server(80);//Service Port int value = HIGH; void setup() { pinMode(relayPin, OUTPUT); digitalWrite(relayPin, HIGH); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); } // Start the server server.begin(); } void loop() { // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data while (!client.available()) { delay(1); } // Read the first line of the request String request = client.readStringUntil('\r'); client.flush(); // Match the request if (request.indexOf("/LED=ON") != -1) { digitalWrite(relayPin, LOW); value = LOW; } if (request.indexOf("/LED=OFF") != -1) { digitalWrite(relayPin, HIGH); value = HIGH; } //Set ledPin according to the request //digitalWrite(ledPin, value); // Return the response client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(""); // do not forget this one client.println("<!DOCTYPE HTML>"); client.println("<html>"); client.print("Relay is now: "); if (value == LOW) { client.print("On"); } else { client.print("Off"); } client.println("<br><br>"); client.println("Click <a href=\"/LED=ON\">here</a> turn the RELAY ON<br>"); client.println("Click <a href=\"/LED=OFF\">here</a> turn the RELAY OFF<br>"); client.println("</html>"); delay(1); }
С делал все по этой инструкции: https://robotchip.ru/obzor-modulya-rele-dlya-esp8266-01s-esp-01s/ , но web страница отваливается буквально через пару нажатий.((( Закрыл вкладлку, открыл и все модуль страницу не отображает (((. Хотя ping идет без потерь. Что можно исправить как думаете? Версия модуля 4.