khoih-prog / EthernetWebServer

This is simple yet complete WebServer library for AVR, AVR Dx, Portenta_H7, Teensy, SAM DUE, SAMD21/SAMD51, nRF52, STM32, RP2040-based, etc. boards running Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Coexisting now with `ESP32 WebServer` and `ESP8266 ESP8266WebServer` libraries. Ethernet_Generic library is used as default for W5x00 with custom SPI
MIT License
178 stars 49 forks source link

Not Working With Default ETH Library #67

Closed unitedsoftworks closed 1 year ago

unitedsoftworks commented 1 year ago

I am trying to use this webserver with the default ETH library for ethernet. The board is the OMILEX ESP32-GATEWAY, which works with the ETH library by default. Currently the Ethernet initializes and works (it is able to receive pings from other devices), but it does not receive web requests (connection refused).

Is there something with the pin mapping that needs to be done to make this work?

#include <ETH.h>
#include <EthernetWebServer.h>
EthernetWebServer ethernetServer(80);

void handleEthernetRoot(){
    ethernetServer.send(200, "text/plain", "Hello from ESP32 Ethernet!");
}

void setup()
{
  Serial.begin(115200);
  ETH.begin();
  ethernetServer.on("/", handleEthernetRoot);
  ethernetServer.begin();
}

void loop()
{
      ethernetServer.handleClient();
}
khoih-prog commented 1 year ago

HI @unitedsoftworks

Start from the working examples of this library first, to see if your board is OK or you have done everything correctly.

Then also verify your knowldge and programming skills by modifying the working examples to know where / when it's broken. Try the similar code on normal ESP32 first, then port to WT32_ETH01 after it's OK.

This is not an issue of this library and will be closed.

Good Luck,