Sketch fails to find Ethertnet.h

I copied over the initial sketch “Cayenne Ethernet Example” and tried to compile it. Got the following error messages:

Arduino: 1.6.5 (Windows 7), Board: “Arduino Uno”

In file included from D:\Documents\Arduino\libraries\Cayenne/CayenneEthernet.h:24:0,
from CayenneSetup.ino:21:
D:\Documents\Arduino\libraries\Cayenne/BlynkSimpleEthernet.h:18:22: fatal error: Ethernet.h: No such file or directory
#include <Ethernet.h>
^
compilation terminated.
Error compiling.

I have a working Arduino with a good Internet connection. I verified that the Ethernet.h file is in the C:\Program Files (x86)\Arduino\libraries\Ethernet\src directory.

I tried copying the Ethernet.h file over to the Cayenne library directory.

The sketch that is currently running in the Arduino uses Ethernet.h and works fine.

Any ideas?
Dan

1 Like

OOPs - part of the error message din’t make it into the post:

Arduino: 1.6.5 (Windows 7), Board: “Arduino Uno”

In file included from D:\Documents\Arduino\libraries\Cayenne/CayenneEthernet.h:24:0,
from CayenneSetup.ino:21:
D:\Documents\Arduino\libraries\Cayenne/BlynkSimpleEthernet.h:18:22: fatal error: Ethernet.h: No such file or directory
#include <Ethernet.h>
^
compilation terminated.
Error compiling.

Dan

1 Like

I guess the submit process is eating the part after the "#include
it should say a#include [angle bracket]Ethernet.h[angle bracket]

Dan

1 Like

Dan,

I just ran the below sketch with one of my tokens plugged in and didn’t have problem.

One thing that comes to mind is have you restarted your Arduino IDE since loading libraries? My understanding is the IDE catalogs the libraries only at start up.

I’m using version 1.6.9 of the IDE.

/*
Cayenne Ethernet Example

This sketch connects to the Cayenne server using an Arduino Ethernet Shield W5100
and runs the main communication loop.

The Cayenne Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:
1. Set the token variable to match the Arduino token from the Dashboard.
2. Compile and upload this sketch.

For Cayenne Dashboard widgets using digital or analog pins this sketch will automatically
send data on those pins to the Cayenne server. If the widgets use Virtual Pins, data
should be sent to those pins using virtualWrites. Examples for sending and receiving
Virtual Pin data are under the Basics folder.
*/

//#define CAYENNE_DEBUG         // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneEthernet.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "";

void setup()
{
	Serial.begin(9600);
	Cayenne.begin(token);
}

void loop()
{
	Cayenne.run();
}

I can help you with posting code-
Paste the code
Highlight all the code
Click on the ‘Preformatted text’ button


1 Like
I tried restarting the Arduino IDE but still got the same results.

However, when I edited the sketch to #include Ethernet.h and SPI.h, it compiled and ran fine.

Since noone else is having this problem, I'll have to assume there is something wrong in my setup that has not been apparent before.

Thanks for you response and the reference to the preformatted text button.

Dan
1 Like

@dbarnett

Dan,

Glad to hear the problem is resolved!

Hope to see some finished :hot_pepper: projects posted soon.

Ian

Hi dbarnett,

I am having the same issue with the Arduino Leonardo Eth.

My board required running a ‘Ethernet2.h’ library whenever include Ethernet into my sketch. However, it seems that Cayenne does not support this yet, since this library does not yet exist.

I have been playing with Blynk aswell and did not think it funny to see “BlynkSimpleEthernet.h” in the error… but now that you are to are getting these errors it cannot be an coincidence.

So the solution was simply to include the SPI? What arduino board are you running?

Yes, the only change I made was to include the Ethernet.h library and the SPI.h library in the sketch.

I was using an Arduino Uno.

Dan

Hi @ruan,

For Leonardo ETH, are you using the W5500 sketch file? This is needed since Leonardo ETH uses that chipset for Ethernet.

What you’ll also need to do is download the Ethernet2 library and add it to your Arduino IDE. Here is the Ethernet2 library that I used:

Then add the Ethernet2 library to the W5500 Cayenne sketch file. I included two pics that will hopefully explain how to select the W5500 sketch file and also how to include the ethernet2 library in the sketch file.

Keep me updated, I hope you can get it working!

-B

Hi Bestes,

Thank you for the speedy reply!

I used the W5500 sketch as recommended and added the ethernet2 library as linked. I think (if I am not mistaken) the arduino IDE (1.7.9 and higher) has the ethernet2 library as a standard, but wanted to double check.

So to continue, using the W5500 sketch and inserting the below two lines extra

#include <Ethernet2.h>
#include <SPI.h>

It worked great. Started playing around with the cloud and interface yesterday and it was fantastic. Keep up the good work!

2 Likes

Ah, I also see you are using the .ORG Arduino IDE. We created our libraries based on the .CC Arduino IDE. This is why you had to use the #include <SPI.h> manually in your sketch file I think. There might be additional small hiccups due to the .ORG IDE, so keep us updated if you encounter issues!

-B