I am trying to establish connection between my PC and wt32-eth01 via ethernet cable. I uploaded this example code from WebServer_WT32_ETH01 to test the ethernet connection.
/****************************************************************************************************************************
HelloServer.ino - Dead simple web-server for Ethernet shields
For Ethernet shields using WT32_ETH01 (ESP32 + LAN8720)
WebServer_WT32_ETH01 is a library for the Ethernet LAN8720 in WT32_ETH01 to run WebServer
Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
Built by Khoi Hoang https://github.com/khoih-prog/WebServer_WT32_ETH01
Licensed under MIT license
*****************************************************************************************************************************/
#define DEBUG_ETHERNET_WEBSERVER_PORT Serial
// Debug Level from 0 to 4
#define _ETHERNET_WEBSERVER_LOGLEVEL_ 4
#include <WebServer_WT32_ETH01.h>
WebServer server(80);
// Select the IP address according to your local network
IPAddress myIP(192, 168, 0, 232);
IPAddress myGW(192, 168, 0, 1);
IPAddress mySN(255, 255, 255, 0);
// Google DNS Server IP
IPAddress myDNS(8, 8, 8, 8);
void handleRoot()
{
Serial.println("Handle root");
String html = F("Hello from HelloServer running on ");
html += String(BOARD_NAME);
server.send(200, F("text/plain"), html);
}
void handleNotFound()
{
String message = F("File Not Found\n\n");
message += F("URI: ");
message += server.uri();
message += F("\nMethod: ");
message += (server.method() == HTTP_GET) ? F("GET") : F("POST");
message += F("\nArguments: ");
message += server.args();
message += F("\n");
for (uint8_t i = 0; i < server.args(); i++)
{
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
server.send(404, F("text/plain"), message);
}
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial);
// Using this if Serial debugging is not necessary or not using Serial port
//while (!Serial && (millis() < 3000));
Serial.print("\nStarting HelloServer on " + String(ARDUINO_BOARD));
Serial.println(" with " + String(SHIELD_TYPE));
Serial.println(WEBSERVER_WT32_ETH01_VERSION);
// To be called before ETH.begin()
WT32_ETH01_onEvent();
//bool begin(uint8_t phy_addr=ETH_PHY_ADDR, int power=ETH_PHY_POWER, int mdc=ETH_PHY_MDC, int mdio=ETH_PHY_MDIO,
// eth_phy_type_t type=ETH_PHY_TYPE, eth_clock_mode_t clk_mode=ETH_CLK_MODE);
//ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_TYPE, ETH_CLK_MODE);
ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER);
// Static IP, leave without this line to get IP via DHCP
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
ETH.config(myIP, myGW, mySN, myDNS);
WT32_ETH01_waitForConnect();
server.on(F("/"), handleRoot);
server.on(F("/inline"), []()
{
server.send(200, F("text/plain"), F("This works as well"));
});
server.onNotFound(handleNotFound);
server.begin();
Serial.print(F("HTTP EthernetWebServer is @ IP : "));
Serial.println(ETH.localIP());
}
void loop()
{
server.handleClient();
}
Sketch loads successfully and prints to serial:
Starting HelloServer on ESP32_DEV with ETH_PHY_LAN8720
WebServer_WT32_ETH01 v1.5.1 for core v2.0.0+
ETH Started
When i connect WT32 and my windows laptop (QTS1081B usb adapter) with a crossover ethernet cable WT32 prints to serial:
ETH Connected
ETH MAC: B0:A7:32:07:31:07, IPv4: 192.168.0.232
HALF_DUPLEX, 10Mbps
HTTP EthernetWebServer is @ IP : 192.168.0.232
The green LED on WT32-eth01 doesn't light up.
Then I configure IP-addresses on my laptop:
But i can't ping WT32 from my laptop and i cant access http://192.168.0.232/ page.
I then tried to connect WT32 with my Raspberry Pi 4. The green led lights up and i can ping WT32 but i still can't access http://192.168.0.232/ page. Nmap shows that all scanned ports on 192.168.0.232 are closed.
My goal is to send basic data from laptop to WT32 via ethernet.