Pages: 1 [2]   Go Down
Author Topic: How to change pins on an LCD  (Read 2064 times)
0 Members and 1 Guest are viewing this topic.
Western New York, USA
Offline Offline
Faraday Member
**
Karma: 35
Posts: 4299
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

Quote
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
Logged

Texas
Offline Offline
Edison Member
*
Karma: 25
Posts: 1298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Good luck, Jack

Atlanta
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Code:
// 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     ");
}
 
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 35
Posts: 4299
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Texas
Offline Offline
Edison Member
*
Karma: 25
Posts: 1298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Good luck, Jack

Texas
Offline Offline
Edison Member
*
Karma: 25
Posts: 1298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just noticed your wording
Quote
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.

Logged

Good luck, Jack

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 35
Posts: 4299
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.


Quote
I don't see how it can be the code either ...
Does the explanation above change your opinion?

Don

Logged

Texas
Offline Offline
Edison Member
*
Karma: 25
Posts: 1298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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).
Logged

Good luck, Jack

Atlanta
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 35
Posts: 4299
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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
Logged

Texas
Offline Offline
Edison Member
*
Karma: 25
Posts: 1298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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".
Logged

Good luck, Jack

Pages: 1 [2]   Go Up
Jump to: