I tried to interface an LCD screen with my Arduino but I have a problem - Nothing is being displayed on my LCD screen:
Here is the code:
#include<LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // sets the interfacing pins
void setup()
{
lcd.begin(16, 2); // initializes the 16x2 LCD
}
void loop()
{
lcd.setCursor(0,0); //sets the cursor at row 0 column 0
lcd.print("16x2 LCD MODULE"); // prints 16x2 LCD MODULE
lcd.setCursor(2,1); //sets the cursor at row 1 column 2
lcd.print("HELLO WORLD"); // prints HELLO WORLD
}
Greenonline
3,1527 gold badges36 silver badges48 bronze badges
-
1Probably your background is not set correctly (there is a way to change the contrast).Michel Keijzers– Michel Keijzers2018年04月03日 13:53:34 +00:00Commented Apr 3, 2018 at 13:53
-
Contrast looks good in the photo -- one row of all-on blocks indicates an uninitialized display.jose can u c– jose can u c2018年04月03日 13:55:54 +00:00Commented Apr 3, 2018 at 13:55
-
Your photo doesn't clearly show where the wires are going. Can you create a schematic showing the wiring setup, or at least a better photo that clearly shows where each wire from the LCD goes to the Arduino?jose can u c– jose can u c2018年04月03日 14:17:38 +00:00Commented Apr 3, 2018 at 14:17
-
@josecanuc the uninitialized screens can be seen even if the contrast is set wrong;esoterik– esoterik2018年07月03日 00:08:09 +00:00Commented Jul 3, 2018 at 0:08
1 Answer 1
In the setup()
you have to state what pin the Vo (display contrast pin) on the LCD is connected to. Before the
lcd.begin(16,2)
try
analogWrite(pin Vo is connected to, contrast you want to set the screen to);
An example would be:
analogWrite(6,80);
Greenonline
3,1527 gold badges36 silver badges48 bronze badges
lang-cpp