W5100_Ethernet.h Library errors on compile

For some reason I am getting a compile error on the Particle W5100_Ethernet library. The library is included in the sketch, but returns an error - see pict:

Trying to set up a link status checker to explore the Particle Ethernet Featherwing that I have sitting here, but can’t even get a good sketch to compile before I proceed with flashing my Argon and the other steps (like enabling Ethernet on my Argon).

/*
  Link Status sketch from:
  This sketch prints the Ethernet link status. When the
  Ethernet cable is connected the link status should go to "ON".
  NOTE: Only WIZnet W5200 and W5500 are capable of reporting
  the link status. W5100 will report "Unknown".
  Hardware:
   - Ethernet shield or equivalent board/shield with WIZnet W5200/W5500
  Written by Cristian Maglie
  This example is public domain.
*/

#include <SPI.h>
#include <Ethernet.h>

void setup() {
  // You can use Ethernet.init(pin) to configure the CS pin
  //Ethernet.init(10);  // Most Arduino shields
  //Ethernet.init(5);   // MKR ETH Shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit FeatherWing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit FeatherWing Ethernet

  Serial.begin(9600);
}

void loop() {
  auto link = Ethernet.linkStatus();
  Serial.print("Link status: ");
  switch (link) {
    case Unknown:
      Serial.println("Unknown");
      break;
    case LinkON:
      Serial.println("ON");
      break;
    case LinkOFF:
      Serial.println("OFF");
      break;
  }
  delay(1000);
}

Is there a better library to use?

Got the sketch from here:


There is no such file, but there is a Ethernet.h which is used in the samples

They may be worth a try (after considering Rick’s points :wink: )

What device are you using?

If you are using the Argon, Boron, B Series SoM, Tracker SoM, P2, or Photon 2 you don’t need a library, Ethernet is built into Device OS. See Ethernet.

If you are using the Photon, P1, Electron, or E Series there might be a library that works, but note that it will not support the cloud connection. On these platforms Ethernet can only be used for direct TCP and UDP.

1 Like

Yeah, I saw that. So why - when you use the “Include in Project” option - does the Particle IDE even use that file??

// This #include statement was automatically added by the Particle IDE.
#include <W5100_Ethernet.h>

@rickkas7 As I mentioned, I happen to want to use an Argon, but that hardly matters for this particular issue since I can’t even get the code to compile separately. It fails during verification, so I didn’t even bother to try to flash it.

I’m not even that interested in connecting to cloud with the Particle Ethernet Featherwing. I just want to verify that the Featherwing works.

When I use the “include in project” method of adding a library to my sketch, it automatically adds this:

// This #include statement was automatically added by the Particle IDE.
#include <W5100_Ethernet.h>

If I comment that out, and just use the Ethernet.h, I get even more errors.

That is an automatism where Web IDE relies on the contributor adhering to the standard that the main include file for a library shall be given the same name as the library itself.
In this case that's obviously not the case.

The ambiguity error probably comes from the fact Rick stated here

Hence you have two conflicting definitions for EthernetClass.
And since the device OS' definition takes precedence the following errors come from the fact that the stock EthernetClass does not feature the same methods and fields as the library samples would assume.

Have you looked at the link Rick provided?
There you may find a way to achieve what you want all without the use of that library :wink:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.