Added Ethernet, LCD garbage

I have just added an Arduino Ethernet shield to a Mega 2560 board.

My existing LCD ( working until now ) was set with :

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

From what I understand with the Ethernet board, I can't use pins 4,10,50,51,52 as thay are used for the features on the Ethernet board.

So I tried moving the LCD pins 2, 3, 4 down to 1, 2, 3 and changed the code to :

LiquidCrystal lcd(1, 2, 3, 5, 6, 7);

Now the display on the LCD is a load of garbage.

Is this something to do with pin 1 being the Tx pin ? If so, can I disable that Tx function and use pin 1 for the LCD, or will that kill the Serial Monitor feature of the IDE ?

Appreciate any advice.

Is this something to do with pin 1 being the Tx pin ? If so, can I disable that Tx function and use pin 1 for the LCD, or will that kill the Serial Monitor feature of the IDE ?

Stay away from pins 0 and 1 if you are using the serial monitor. With all of the pins available on the Mega why are you having so much trouble finding a free one?

If your initial setup worked with

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

and you cannot use pin 4 then all you have to do is find one other free pin and use it in place of pin 4. You would then use

LiquidCrystal lcd(2, 3, [b]x[/b], 5, 6, 7);

where 'x' is the free pin.

Don

Thanks Don

Many Thanks for the prompt reply.

So what you're saying is that I should always keep pins 0 and 1 open ?

Would the same apply to pins 14 - 21, which are also marked for "communication", or can I use those for the LCD ?

Regards

So what you're saying is that I should always keep pins 0 and 1 open ?

Would the same apply to pins 14 - 21, which are also marked for "communication", or can I use those for the LCD ?

Virtually all of the I/O pins on the Atmel chips serve dual purposes. They are available for general purpose I/O (such as driving an LCD display) if they are not being used for one of those other purposes.

Pins 0 and 1 are used for downloading your programs via the bootloader and for the Serial Monitor. If your program does not use the Serial Monitor then you can use it for other purposes after your sketch has been loaded. This is usually more trouble than it is worth unless you are really in need of I/O pins.

On the Mega pins 14 - 19 are used for the additional serial ports available on that device and pins 20 and 21 are used for external interrupts. If you are not using those functions then those pins are available for your LCD.

Don

Many Thanks Don