0
#include <Arduino.h>
#include <WiFi.h>
#include <AsyncTCP.h>
#include <HTTPClient.h>
#include <ESPAsyncWebServer.h>
#include <DallasTemperature.h>
#include <OneWire.h>
#include <SPIFFS.h>
#include <WiFiManager.h>
#define ONE_WIRE_BUS 4

float version = 1.4;

WiFiManager wifiManager;

AsyncWebServer server2(80);
WiFiServer server(80);

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress tempDeviceAddress; 
int numberOfDevices;

extern String payloadtemperature;

extern String readFile(fs::FS &fs, const char * path);
extern void writeFile(fs::FS &fs, const char * path, const char * message);

String guidevices;
const char* PARAM_GUIDEVICES = "guidevices";

void setup() {
  Serial.begin(115200);
  sensors.begin();
  SPIFFS.begin(true);

  wifiManager.autoConnect("FlexGreen-Temp", "FlexGreen");

  server2.on("/temperature", HTTP_GET, [](AsyncWebServerRequest *request){
  request->send_P(200, "text/plain", payloadtemperature.c_str());
  }); 

  server2.on("/sensors", HTTP_GET, [] (AsyncWebServerRequest *request){
  guidevices = request->getParam(PARAM_GUIDEVICES)->value();
  writeFile(SPIFFS, "/devices.txt", guidevices.c_str());
  });

  // Grab a count of devices on the wire
  String devices = readFile(SPIFFS, "/devices.txt");
  numberOfDevices = devices.toInt();

  Serial.print(numberOfDevices, DEC);
  Serial.println(" devices.");

  // Loop through each device, print out address
  for (int i=0;i<numberOfDevices; i++) {
  }
}


void loop() { 
  sensors.requestTemperatures();
  for (int i=0;i<numberOfDevices; i++) {
    if (sensors.getAddress(tempDeviceAddress, i)) {
      Serial.print("Temperature for device: ");
      Serial.println(i,DEC);
      float tempC1 = sensors.getTempC(tempDeviceAddress);
      float tempF1 = DallasTemperature::toFahrenheit(tempC1);
      Serial.print("Temp C: ");
      Serial.print(tempC1);
      Serial.print(" Temp F: ");
      Serial.println(tempF1);
      delay(5000);
    }
  }
}

Since yesterday I get an error which I haven't been able to solve. I get this error with all my projects and have already tried to completely delete all the core ESP files.

ERROR CODE:

In file included from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiManager/WiFiManager.h:106,
                 from src/main.cpp:9:

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:95:6: error: 'HTTP_DELETE' conflicts with a previous declaration
   XX(0,  DELETE,      DELETE)       \
      ^

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~

In file included from src/main.cpp:5:
.pio/libdeps/esp32doit-devkit-v1/ESPAsyncWebServer-master/src/ESPAsyncWebServer.h:64:3: note: previous declaration 'WebRequestMethod HTTP_DELETE'
   HTTP_DELETE  = 0b00000100,
   ^~~~~~~~~~~

In file included from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiManager/WiFiManager.h:106,
                 from src/main.cpp:9:

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:96:6: error: 'HTTP_GET' conflicts with a previous declaration
   XX(1,  GET,         GET)          \
      ^

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~

In file included from src/main.cpp:5:
.pio/libdeps/esp32doit-devkit-v1/ESPAsyncWebServer-master/src/ESPAsyncWebServer.h:62:3: note: previous declaration 'WebRequestMethod HTTP_GET'
   HTTP_GET     = 0b00000001,
   ^~~~~~~~

In file included from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiManager/WiFiManager.h:106,
                 from src/main.cpp:9:

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:97:6: error: 'HTTP_HEAD' conflicts with a previous declaration
   XX(2,  HEAD,        HEAD)         \
      ^

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~

In file included from src/main.cpp:5:
.pio/libdeps/esp32doit-devkit-v1/ESPAsyncWebServer-master/src/ESPAsyncWebServer.h:67:3: note: previous declaration 'WebRequestMethod HTTP_HEAD'
   HTTP_HEAD    = 0b00100000,
   ^~~~~~~~~

In file included from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiManager/WiFiManager.h:106,
                 from src/main.cpp:9:

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:98:6: error: 'HTTP_POST' conflicts with a previous declaration
   XX(3,  POST,        POST)         \
      ^

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~

In file included from src/main.cpp:5:
.pio/libdeps/esp32doit-devkit-v1/ESPAsyncWebServer-master/src/ESPAsyncWebServer.h:63:3: note: previous declaration 'WebRequestMethod HTTP_POST'
   HTTP_POST    = 0b00000010,
   ^~~~~~~~~

In file included from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiManager/WiFiManager.h:106,
                 from src/main.cpp:9:

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:99:6: error: 'HTTP_PUT' conflicts with a previous declaration
   XX(4,  PUT,         PUT)          \
      ^

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~

In file included from src/main.cpp:5:
.pio/libdeps/esp32doit-devkit-v1/ESPAsyncWebServer-master/src/ESPAsyncWebServer.h:65:3: note: previous declaration 'WebRequestMethod HTTP_PUT'
   HTTP_PUT     = 0b00001000,
   ^~~~~~~~

In file included from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiManager/WiFiManager.h:106,
                 from src/main.cpp:9:

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:102:6: error: 'HTTP_OPTIONS' conflicts with a previous declaration
   XX(6,  OPTIONS,     OPTIONS)      \
      ^

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~

In file included from src/main.cpp:5:
.pio/libdeps/esp32doit-devkit-v1/ESPAsyncWebServer-master/src/ESPAsyncWebServer.h:68:3: note: previous declaration 'WebRequestMethod HTTP_OPTIONS'
   HTTP_OPTIONS = 0b01000000,
   ^~~~~~~~~~~~

In file included from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiManager/WiFiManager.h:106,
                 from src/main.cpp:9:

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:128:6: error: 'HTTP_PATCH' conflicts with a previous declaration
   XX(28, PATCH,       PATCH)        \
      ^~

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~

C:/Users/Jay van de Wetering/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~

In file included from src/main.cpp:5:
.pio/libdeps/esp32doit-devkit-v1/ESPAsyncWebServer-master/src/ESPAsyncWebServer.h:66:3: note: previous declaration 'WebRequestMethod HTTP_PATCH'
   HTTP_PATCH   = 0b00010000,
   ^~~~~~~~~~

*** [.pio\build\esp32doit-devkit-v1\src\main.cpp.o] Error 1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.