Auto reconnecting between Ethernet shield and esp8266

Hi blynkers,

Could you please help me with my project…

Idea is to automatically reconnect arduino DUE from one internet connection (ethernet shield) to another one (esp8266) and back.
Ethernet shield is connected to router and it’s a main arduino connection to the server.
Esp8266 is connected to wi-fi and modem is a smartphone with 4G. So there is another one network for arduino and it’s using it only when main connection is lost.

Each connection (ethernet and esp8266) separately is working ok. There is no problem here.
How to check connection status of ethernet and reconnect to esp8266 is clear as well.
But I cant figure out how to make work two shields together with arduino and blynk.

I can’t include 2 libraries BlynkSimpleShieldEsp8266.h and BlynkSimpleShieldEthernet.h in same sketch.

Maybe there is another way to do it and I just can’t figure it out…

Thanx

@diorio: I’d use a router that establishes an external connection via 4G to the internet in case the line connected internet access fails and simply connect the DUE to it via LAN.

Side note: As long as you have two identical shields that you can active/deactivate via Reset (like the ESP8266) or via Chip Select (CS) (like the Ethernet cards) you can use more than one - whereas with the ESP8266 it does not really make sense.

For the Ethernet shield the only thing you have to do is move the Chip Select (CS) of the second one from Pin 10 (standard) to e.g. Pin 9.

The rest is connetion handling and activation/deactivation of the right interface.