LCD and Ethernet Shield

I’ve encountered a problem when using the new Ethernet Shield (Mega compatible) with my Arduino Mega 2560.

I have verified that the LCD functions work correctly and the ethernet shield works correctly but when I combine the two I get some problems.

If I try to print to the lcd using the code below the LCD displays question marks symbols on the LCD screen as follows:

LCD
line1:
line2:???

#include <LiquidCrystal.h>
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,0,25 };

LiquidCrystal lcd(48, 46, 49, 50, 51, 52, 53);

void setup() 
{
  Ethernet.begin(mac, ip);
  lcd.begin(16, 2);
  delay(1000);
}

void loop() 
{
  lcd.print("Test");
  delay(10000);
}

But when I print to the LCD before initializing the ethernet shield everything works correctly.

What do you think?

While you have freedom with the LCD pins you don't with the SPI pins on the Ethernet interface. So use different pins on the LCD, that don't clash, that is avoid pins 50 to 53 on the LCD.

Awesome! I forgot those were SPI pings. Thanks!