LCD Question

Hi, I wonder if somebody could advise me please.

I have a couple of little LCD projects up and running and on the whole, I’m very pleased with them. I have noticed though, that the pin configurations in the sketches are different.

Below are two examples of different sketches where the LCD is declared:

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

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

They both work, but how? How does the Arduino know which pin is connected to where? Can you use any pins you want as long as you declare them? Do they have to be declared in a certain order for it to work?

Thanks for any advice.

Kind regards Paul

Have a look at the library documentation: and more specifically about your initialization questions here:

That should help clear things up.

--- bill

All they really had to do was just include a comment - but that would make things too easy.

//LiquidCrystal lcd(RS, EN, D4, D5, D6, D7);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


That's great guys, thank you very much.

I was hoping that would be the case as it gives me a lot more flexibility with my pin placing.

I searched lots of posts first but completely forgot about the reference section.

Thanks again.

Kind regards Paul