I have the following code;
#include <Ethernet.h>
#include <SPI.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(31, 30, 29, 28, 27, 26, 25, 24, 23, 22);
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetClient client;
void setup()
{
Serial.begin(9600);
//client.begin(mac);
//Init Ethernet Comms
Serial.println(F("Start."));
while (!Ethernet.begin(mac) == 0) {
Serial.println(F("Network Error"));
delay(200);
};
Serial.println(F("Connected"));
}
void loop() {}
As it is above it gets out of the while loop. However, if i remove the line LiquidCrystal lcd(31, 30, 29, 28, 27, 26, 25, 24, 23, 22);
It will then fail to connect, and stay in the loop. Im at a complete loss here as the Ethernet shield and 2x16 LCD are unrelated devices, and if anything id expect the addition of used pins to cause issue, not the removal.
Edit: I should note this is occurring on two devices, one Mega one Uno.
2nd Edit: As pointed out by Juraj in the comments, this can be resolved using Ethernet.Init(CS_Pin) where CS_Pin is an unused pin, in my case D9.
Ethernet.init(10);
. What happens if you disconnect the LCD? – Juraj Oct 23 '19 at 15:07