BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Arduino choice of ethernet shield?


#1

As mentioned in another post, I have problem finding the right ethernet shield for arduino.

Ethernet shield based on WS5200 (Seed) have documented issues and are totally unreliable.
For Ethernet shield2 based on WS5500, there is a compatibility problem between the keypad.lib and the Ethernet2. lib

I am looking for a shield working properly with Blynk and the keypad.lib.

Any suggestion.

I have not tried yet the older shield based on WS5100 with the Ethernet.lib (but there is apparently no libraries conflict with the keypad.lib)


#2

To help us troubleshoot, In what way have you determined the incompatibility? Errors at compilation or from other documents, or just because nothing works the way it should :wink:

EDIT - Without further input, I am just guessing here… but after looking at the keypad.lib - http://playground.arduino.cc/Code/Keypad - I noted that there is at least one command that is blocking, and if used would cause some conflicts with Blynk:

char waitForKey()

This function will wait forever until someone presses a key. Warning: It blocks all other code until a key is pressed. That means no blinking LED’s, no LCD screen updates, no nothing with the exception of interrupt routines.


#3

I have no problem when compiling with :

#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

(not tested yet with a WS5100 ethernet shield - just compiling and uploading for test)
or

#include <EthernetV2_0.h>
#include <BlynkSimpleEthernetV2_0.h>

(except of course for the problem with the WS5200 shield - but when then this shield by chance connect to the internet, the whole project including Blynk functions, works perfectly)

However when compiling with:

#include <Ethernet2.h>
#include <BlynkSimpleEthernet2.h>

I have the following errors:

_In file included from sketch\Blink_States_15-3-17_WS5500.ino.ino.cpp:1:0:_

_C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:40:14: error: expected unqualified-id before numeric constant_

_ #define HIGH 0x1_

_              ^_

_C:\Users\Automatic Industries\Google Drive\Arduino\libraries\Keypad\src/Keypad.h:56:16: note: in expansion of macro 'HIGH'_

_ #define CLOSED HIGH_

_                ^_

_C:\Users\Automatic Industries\Google Drive\Arduino\libraries\Ethernet2\src/utility/w5500.h:99:24: note: in expansion of macro 'CLOSED'_

_   static const uint8_t CLOSED      = 0x00;_

_                        ^_

_exit status 1_
_Error compiling for board Arduino/Genuino Mega or Mega 2560._

#4

Sorry, I do not know why INCLUDE appears in my message …


#5

You need to format any code you paste here by placing the three backticks and the letters cpp in front of the code followed by three more backticks at the end. NOTE the backtick key is NOT a quotation or comma… see the diagram below.

I have edited your above post with the code snippets, to show you how it is done.

Click on the edit icon (see below) at the bottom of your post and you will be able to see how the formatting is done for the future.


#9

Thanks Gunner.


#10

I just use the W5100 and it works fine:slight_smile:


#11

We need to see the entire code to determine if there is some syntax errors or something else that might explain all the errors. Thanks.


#12

Found the solution

I inserted the “Blynk library calls” at the beginning of the sketch before any other libraries and no more error in compilation!

//Blynk - as very first lines of the sketch
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <Ethernet2.h>
#include <BlynkSimpleEthernet2.h>

For testing I moved it back after the other libraries insert, and the compilation error reappeared.

I do not know if this makes any programming sense but as long as it solved the issue…