1

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.

2
  • do you have SD card inserted? if yes remove it or set the SD CS pin 4 HIGH. And I would add Ethernet.init(10);. What happens if you disconnect the LCD? Commented Oct 23, 2019 at 15:07
  • You beauty, that was exactly the issue. Oddly i have been using both the SD card and Ethernet port without issue for a while now, but only recently ran into this issue. Commented Oct 23, 2019 at 15:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.