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
    – Hexash
    Feb 25 at 20:38
1

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

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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.