1

I've mounted an Ethernet Shield on top of an Arduino UNO. The Arduino is connected via usb to my pc and to the network via ethernet through a switch. I'm running a simplified verison of the WebServer example and the function to Ethernet.begin() always returns EthernetNoHardware.

I've tried different setups changing the ethernet cables and connecting directly to the router. I also tried adding specific ip, gateway and subnet parameters to Ethernet.begin() however the output doesn't change and the server can't be reached:

#include <SPI.h> #include <Ethernet.h> byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0xCC, 0x1E }; //mac address on the sticker IPAddress ip(192, 168, 1, 134); IPAddress gateway(192,168,1,1); IPAddress subnet(255,255,255,0); IPAddress DNSserver(192,168,1,1); EthernetServer server(80); void setup() { Ethernet.init(10); Serial.begin(9600); while (!Serial) { ; } Ethernet.begin(mac, ip, gateway, subnet); if (Ethernet.hardwareStatus() == EthernetNoHardware) { Serial.println("Ethernet shield not found."); } server.begin(); Serial.print("server is at "); Serial.println(Ethernet.localIP()); } 

output:

Ethernet shield not found. server is at 192.168.1.134 

Any idea on what the issue might be?

1
  • I'm using a W5100 Commented Feb 25, 2021 at 20:38

1 Answer 1

1

In your sketch DNS IP parameter is missing in Ethernet.begin.

It should be Ethernet.begin(mac, ip, dns, gateway, subnet);

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.