сервер espasync не работает, я получаю это сообщение об ошибке
Arduino: 1.8.14 Hourly Build 2020/12/15 11:33 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:4:
C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:62:18: error: 'HTTP_GET' conflicts with a previous declaration
62 | HTTP_GET = 0b00000001,
| ^~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:2:
C:\Users\JUNAID\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:47:29: note: previous declaration 'HTTPMethod HTTP_GET'
47 | enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
| ^~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:4:
C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:63:18: error: 'HTTP_POST' conflicts with a previous declaration
63 | HTTP_POST = 0b00000010,
| ^~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:2:
C:\Users\JUNAID\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:47:50: note: previous declaration 'HTTPMethod HTTP_POST'
47 | enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
| ^~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:4:
C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:64:18: error: 'HTTP_DELETE' conflicts with a previous declaration
64 | HTTP_DELETE = 0b00000100,
| ^~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:2:
C:\Users\JUNAID\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:47:83: note: previous declaration 'HTTPMethod HTTP_DELETE'
47 | enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
| ^~~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:4:
C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:65:18: error: 'HTTP_PUT' conflicts with a previous declaration
65 | HTTP_PUT = 0b00001000,
| ^~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:2:
C:\Users\JUNAID\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:47:61: note: previous declaration 'HTTPMethod HTTP_PUT'
47 | enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
| ^~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:4:
C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:66:18: error: 'HTTP_PATCH' conflicts with a previous declaration
66 | HTTP_PATCH = 0b00010000,
| ^~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:2:
C:\Users\JUNAID\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:47:71: note: previous declaration 'HTTPMethod HTTP_PATCH'
47 | enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
| ^~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:4:
C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:67:18: error: 'HTTP_HEAD' conflicts with a previous declaration
67 | HTTP_HEAD = 0b00100000,
| ^~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:2:
C:\Users\JUNAID\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:47:39: note: previous declaration 'HTTPMethod HTTP_HEAD'
47 | enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
| ^~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:4:
C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:68:18: error: 'HTTP_OPTIONS' conflicts with a previous declaration
68 | HTTP_OPTIONS = 0b01000000,
| ^~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:2:
C:\Users\JUNAID\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:47:96: note: previous declaration 'HTTPMethod HTTP_OPTIONS'
47 | enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
| ^~~~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:4:
C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:69:18: error: 'HTTP_ANY' conflicts with a previous declaration
69 | HTTP_ANY = 0b01111111,
| ^~~~~~~~~~
In file included from C:\Users\JUNAID\Documents\Arduino\iot_project_4\iot_project_4.ino:2:
C:\Users\JUNAID\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\libraries\ESP8266WebServer\src/ESP8266WebServer.h:47:19: note: previous declaration 'HTTPMethod HTTP_ANY'
47 | enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
| ^~~~~~~~
Multiple libraries were found for "ESPAsyncTCP.h"
Used: C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncTCP
Not used: C:\Users\JUNAID\Documents\Arduino\libraries\ESPAsyncTCP-master
exit status 1
Error compiling for board Generic ESP8266 Module.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
код
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
int Wifiled = 15;
ESP8266WebServer esp(80);
String HTML = "";
String FORM = "testing the second website";
void setup()
{
HTML +="<html>";
HTML += "<head>";
HTML += "<title>MY SMART HOME</title>";
HTML +="<style>";
HTML +="body {background-color:#92e8e2;}";
HTML +="#wrapper {background-color:#ebf5f4;width:93%;min-height:700px;margin:auto;barder:1px solid #ccc;padding:10px;}";
HTML +="</style>";
HTML += "</head>";
HTML += "<body>";
HTML += "<div id='wrapper'>";
HTML += "<h3>WELCOME TO MY SMART SENSOR DATA</h3>";
HTML += "<h2>PH SENSOR DATA </h2>";
HTML += "Serial.monitor";
HTML += "<h2>EC SENSOR DATA </h2>";
HTML += "</div >";
HTML += "</body>";
HTML +="</html>";
pinMode(Wifiled,OUTPUT);
delay(1000);
Serial.begin(115200);
WiFi.begin("LAPTOP","123456789");
while(WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
digitalWrite(Wifiled,HIGH);
delay(250);
digitalWrite(Wifiled,LOW);
delay(250);
}
digitalWrite(Wifiled,HIGH);
Serial.println("wifi connected");
Serial.println(WiFi.localIP());
esp.on("/",sendHtml);
esp.on("/process",sendform);
esp.begin();
}
void sendform()
{
esp.send(200,"text/html;",FORM);
}
void sendHtml()
{
esp.send(200,"text/html;",HTML);
}
void loop()
{
esp.handleClient();
delay(200);
char buffer[20]="";
if(Serial.available()>0){
// char data=Serial.read();
Serial.readBytesUntil('\n',buffer,20);
Serial.println(buffer);
}
}
@ Lasmon, 👍2
Обсуждение1 ответ
▲ 2
Вы включили <ESP8266WebServer.h> и <ESPAsyncWebServer.h>, это одно или другое, вы не можете иметь оба. Следовательно, вы получаете сообщение об ошибке: «HTTP_GET» конфликтует с предыдущим объявлением
,
@Bra1n
Смотрите также:
- Как подключить Wi-Fi Shield ESP-12E-ESP8266-UART-WIFI-Wireless-Shield к Arduino
- Подключение ESP8266 и PN532
- Ошибка компиляции ESP8266: "previous declaration of 'HTTPMethod HTTP_HEAD'"
- Чтение OID SNMP V2 из ESP8266/ESP32
- Трассировка стека сброса ESP12E Soft WDT ведет к библиотекам
- Библиотека ESP8266: получено 2 запроса вместо 1
- Странная проблема с software serial
- Вызов метода в основном скетче из библиотеки.
ESP8266WebServer конфликтует с ESPAsyncWebServer. Оба не могут быть использованы в одной и той же программе. Похоже, что ваш код не использует make use ESPAsyncWebServer или его функции, поэтому вы можете удалить строки
#include <ESPAsyncTCP.h>
и#include <ESPAsyncWebServer.h>
из своего кода., @StarCatпожалуйста, добавьте четкий вопрос, на который можно ответить, к своему сообщению, @jsotola