How to change pins on an LCD

My old code used this statement for the initialization. "LiquidCrystal lcd(2, 8, 9, 10, 11, 12);" How do I get my LCD to operate using different pins?

Until you provide us with a picture or an accurate description of the interconnections between your LCD and your Arduino we cannot tell if you understand the significance of the numbers within the parentheses, specifically the significance of the order in which the numbers appear.

Of course it doesn't help that the author of the sketch, and the author of the example upon which it is based didn't explain this either. I think this is a bit more informative:

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here

Don

Attached is my snippet of my schematic connection for the LCD.
Here is the code for pin setup.

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(12, 11, 10, 8, 3, 2 );

Here is the link to the display.

LCD connections.JPG

It appears the wiring is correct.
You say it works with one arduion, but not with the other. Is that running the arduion boards with only the display , or does one have other peripherals attached?
When It does not work, what does it actually do/not do?

At this point, looks like the LCD is good. Looks like your sketch is good. Looks like your wiring is good., and at least one arduino board is good. It is getting narrowed down now. Did you get the pins checked on the questionable arduino board yet?

From your original post --> "All I did was change the pins and now it does not work."

Have you tried going back to the original configuration to see if it still works as it did before?

Don

The old config seems to not work with the Mega 2560 also. I checked all the pin (D0-D13) with a 1 Hz pulse programs. All the pins flashed the LED/resistor that I put on them. Pins seem to be fine. Th ADK Mega works and the Mega 2560 does not. I have no clue why.

Is that running the arduion boards with only the display , or does one have other peripherals attached?

Add the loop() function, and have it also send info to the lcd, ever so often (one second maybe).

Add the loop() function, and have it also send info to the lcd, ever so often (one second maybe).

I disagree. If you can't get the display to work with static information then sending it stuff over and over again will only make the troubleshooting harder.

So far we have only seen program fragments and a diagram of how he intends to connect the display. In order to provide decent help we have to see the actual circuit connections, the actual code used (all of it) with those connections, and the actual resulting display.

Don

I think the OP gave us his complete sketch in his first post, and it did not include a loop() function. It may not be the problem, but I see that some boards/systems, really do want the loop() to be there (even if empty). I was hoping he could add the loop(), and put in two or three lines to make the display continue to work.
Can't hurt.

I think he also provided us the exact wiring diagram he is using (posted early today). It looked correct to me.

Still a mystery, but not for long (I hope). LOL

I think the OP gave us his complete sketch in his first post, and it did not include a loop() function.

And I told him about that in reply #3, but we don't know if he actually did put an empty loop() in to his sketch. Hence we need to see the complete code that he is now having a problem with so we can find out.

I think he also provided us the exact wiring diagram he is using (posted early today).

But we don't know that he implemented it properly. Hence we have to see the actual connections that he is now having a problem with so we can find out.

Don

Hi Don,
Yea, it is hard to trouble shoot over the internet.
We can ask questions, get answers. Sometime we suspect those answers are not really what we ask, but !
I think this OP is not a novice. He has provided answers with accuracy. He may know more than I do (not that much). And you are right, if the sketch has been updated, we need to see it.
Isn't this forum fun. (not a pun, really).

My code is extremely long so it would not be good to post here (924 lines). Here is the jist of my code. Again I do not see how it can be the code if it works with the Mega ADK and not the Mega 2560.

// include the library code:
#include <LiquidCrystal.h>

//------------ initialize the library with the numbers of the interface pins
//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(12, 11, 10, 8, 3, 2 ); 
void setup() {
    
   // set up the LCD's number of columns and rows: 
   lcd.begin(16, 2);                           // LCD is a 16 by 2 character array
   
   lcd.setCursor(0, 0);
   lcd.print("Manufactured by:"); 
}
void loop() {
lcd.setCursor(3, 1);
                                lcd.print(" Fahrenheit     ");
}

First of all you should delete the code from within loop() or move it to setup() since it will just drive the display bonkers the way you have it now. Leave the contents of loop blank between the brackets.

Then we also have to see how you connected your display to your Arduino. We need to see how you actually connected it, not how you proposed to connect it.

Don

Seems to be a disagreement about having something running in loop(), But What if the program is not running for some reason? I still think something should be put into loop() with a delay of about a second.
Put both the print to lcd, and blink led so we can see if the sketch is running. Just my opinion.

I just noticed your wording

My code is extremely long so it would not be good to post here (924 lines). Here is the jist of my code

. Does that mean the sketch you show is, is not actually being run in the arduino? Or you are running the cut down code that you are showing us?

I don't see how it can be the code either, but as of yet, I don't see exactly what it is.If we keep trying things, between all of us, we are bound to come to a conclusion.

Put both the print to lcd, and blink led so we can see if the sketch is running. Just my opinion.

You absolutely do NOT want to repeatedly send information to an LCD in loop() before you establish the fact that you can write information to it in setup().

If you want to verify that your sketch is running you should use an LED in loop(), but you do NOT want to do anything to the LCD that you are troubleshooting. It's just too easy to overwrite the information that you may have successfully displayed in setup() before your eyes ever get a chance to realize that it was there.

I don't see how it can be the code either ...

Does the explanation above change your opinion?

Don

It's just too easy to overwrite the information that you may have successfully displayed in setup() before your eyes ever get a chance to realize that it was there.

That is a good point Don. there should be a delay(2000) at the end of setup(). But as I understood it, he never saw it successfully displayed in setup(). I am just trying to have him add debug code, because I have not yet got a grasp on what the problem is. It you don't find it after the first 5 debug codes, add another, and another. my grand pappy would say.
If we all hang in there, I bet we will find the problem (tonight, or tomorrow I bet).

Well I got my hands on another Mega 2560 and that one works with the code so it is obviously my mega. All my pins work so I am still confused about why it does not work.

All my pins work so I am still confused about why it does not work.

One by one carefully switch the wires back to the first mega and it may very well work also.

Don

Still a mystery.
Just to be be clear:

  1. You now have two Mega 2560 boards. One works and the other one does not ?
  2. You have the same sketch loaded into both boards, and you can tell it is running by the blinking led (D13) ?
  3. You wire them both the same way ?

Is that a small sketch just for testing, or a full blown project sketch? If it is a small one, could you post the current one again?

What could it be? There has to be an answer. And it is probably like we are "to close to see the forest".