Copenhagen, Denmark
Offline
Newbie
Karma: 0
Posts: 3
|
 |
« on: July 24, 2011, 02:10:21 pm » |
Hi guys
Hoping someone have a bright idea about what's wrong with my display.
It's wired up to my Arduino Mega 2560 and as long as i'm utillizing "lcd.begin(16, 1);" everything works fine, great contrast and all (Though I can only use 1 line). When I change the "lcd.begin(16, 2);" then the text in the display nearly fades completely out. I can barely make out the "hello, world!" and the next line does have the seconds counting up, but it's very low contrast.
I'm using the standard "Hello Example" as pasted below.
// include the library code: #include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("hello, world!"); }
void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis()/1000); }
I hope someone have an idea?
Best regards Nicklas
|
|
|
|
|
Logged
|
|
|
|
|
Germany
Offline
God Member
Karma: 69
Posts: 798
If you believe something is right, you won't see what's wrong (David Straker).
|
 |
« Reply #1 on: July 24, 2011, 02:48:09 pm » |
some delay might help:
void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis()/1000); delay(100); }
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5914
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #2 on: July 24, 2011, 03:00:53 pm » |
Did you use a potentiometer?
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen, Denmark
Offline
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #3 on: July 24, 2011, 05:56:36 pm » |
Yes I have a 10K potensiometer mounted at the Vo input on the display. and it's working as long as I'm only utillizing the upper line in the display. I've now tried to use some delay 100-1000ms and it's still the same. I've measured the voltage on the supply from the Arduino and it's 4,99V. the Vo input at the display gets 0V at min. and 4,98V at max.
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5914
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #4 on: July 24, 2011, 06:04:42 pm » |
If you do lcd.begin(16,2); and then adjust the potentiometer, will you get a better contrast? How did you connect the potentiometer to the lcd? A nice picture will be needed.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5914
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #6 on: July 24, 2011, 06:55:07 pm » |
Do you have a spec sheet of this display? I don't know which pin is V0. Usually if you have one row connection the V0 goes to pin 3. But I don't know about this display.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 209
Office meets Adruino
|
 |
« Reply #7 on: July 24, 2011, 07:22:51 pm » |
with the pins stacked with two rows of 8 like that on the breadboard, would it not short them out?
do you have a datasheet for that display?
|
|
|
|
|
Logged
|
|
|
|
|
Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3457
|
 |
« Reply #8 on: July 24, 2011, 07:25:30 pm » |
with the pins stacked with two rows of 8 like that on the breadboard, would it not short them out? It looks like the brown and black wires fit into the 'slot' and are not connected to the breadboard pins. They're obviously not shorted out, the display is working.Don
|
|
|
|
|
Logged
|
|
|
|
|
Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3457
|
 |
« Reply #9 on: July 24, 2011, 07:25:40 pm » |
I've measured the voltage on the supply from the Arduino and it's 4,99V. the Vo input at the display gets 0V at min. and 4,98V at max. That's a good sign. With the display showing "Hello World" as in your third picture you should be able to adjust your potentiometer and get the contrast to change. The display should fade out as you increase the voltage at pin 3 and it should get darker when you decrease the voltage. If this works as expected then your potentiometer is probably wired correctly and you can procede.
You cannot adjust the contrast with the display set up for the one line mode and expect that same setting to work for the two line mode, you will have to readjust the setting after you switch modes. You will typically find that the display looks good with about 0.3V at pin 3.Don
|
|
|
|
« Last Edit: July 24, 2011, 07:27:34 pm by floresta »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #10 on: July 28, 2011, 07:46:24 am » |
Maybe a Delay and lcd.clear command? yesterday i begun testing my 16x2 LCD. and i also had some txt that was hard to read. solution, put a delay in your code + a lcd.clear command. this is my code. // include the library code: #include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins LiquidCrystal lcd(8, 9, 4, 5, 6, 7); int ldr =9; int waarde; int potMeter =15; int ldrwaarde; int licht =12; int ldrwaarde2;
void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2);
}
void loop() { ldrwaarde = analogRead(ldr); lcd.setCursor(0,0); lcd.print("LWS:"); lcd.setCursor(4,0); lcd.print(ldrwaarde); waarde = analogRead(potMeter); lcd.setCursor(0,1); lcd.print("Pot:"); lcd.setCursor(4,1); lcd.print(waarde); ldrwaarde2 = analogRead(licht); lcd.setCursor(8,0); lcd.print("LWS2:"); lcd.setCursor(13,0); lcd.print(ldrwaarde2); if (ldrwaarde2 == ldrwaarde ){ lcd.setCursor(9,1); lcd.print("Gelijk!"); } else{ lcd.setCursor(10,1); lcd.print("..."); } delay(450); lcd.clear(); }
|
|
|
|
|
Logged
|
|
|
|
|
Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3457
|
 |
« Reply #11 on: July 28, 2011, 10:11:07 am » |
@holahoep:
You need the delay in your sketch for an entirely different reason. Without the delay your display is constantly being rewritten, much faster than you or any one else can possibly read it. You need the delay in order to have a stable display before any new data is displayed.
The 'clear' function takes a much longer time for the LCD to complete than most of the other instructions. The required delay is already built into the library. You should consider rewriting your sketch to eliminate it. You should display the unchanging titles in setup() and just update the values in loop(). This will involve positioning the cursor at the start of an old value, displaying several 'spaces' to erase that value, repositioning the cursor, and displaying the new value. This sounds like a lot of work but it is better than clearing the screen.
Don
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #12 on: July 28, 2011, 12:51:29 pm » |
@holahoep:
You need the delay in your sketch for an entirely different reason. Without the delay your display is constantly being rewritten, much faster than you or any one else can possibly read it. You need the delay in order to have a stable display before any new data is displayed.
The 'clear' function takes a much longer time for the LCD to complete than most of the other instructions. The required delay is already built into the library. You should consider rewriting your sketch to eliminate it. You should display the unchanging titles in setup() and just update the values in loop(). This will involve positioning the cursor at the start of an old value, displaying several 'spaces' to erase that value, repositioning the cursor, and displaying the new value. This sounds like a lot of work but it is better than clearing the screen.
Don
Now i changed the unchanging titles to setup. But don't know what you mean with the cursor thing. i used the clear command to reset the screen. because when my potentio meter goes to 1023, and i turn hum back to 3 numbers, like 932) the 4th digit will stay in my screen. But i dont understand your message how to get rid of the '4th' digit.
|
|
|
|
|
Logged
|
|
|
|
|
Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3457
|
 |
« Reply #13 on: July 28, 2011, 02:01:09 pm » |
Now i changed the unchanging titles to setup. But don't know what you mean with the cursor thing. i used the clear command to reset the screen. because when my potentio meter goes to 1023, and i turn hum back to 3 numbers, like 932) the 4th digit will stay in my screen. But i dont understand your message how to get rid of the '4th' digit. Let's say you want to print a new value for "ldrwaarde". 1. Position your cursor to (4, 0) 2. Print four spaces to cover up the old value 3. Position the cursor back to (4,0) 4. Print the new value of "ldrwaarde"
Don
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #14 on: July 29, 2011, 03:29:14 am » |
Hi,
i did
lcd.print(" ");
it works..but i need the delay on the end of my code. otherwise i can't read the digits on my lcd screen because of the refresh. you also told me but i dont know you mean.
|
|
|
|
|
Logged
|
|
|
|
|
|