[Solved] new LCD display not properly showing text

I'm having a problem with my LCD display.
It's 16x2, i've written some code to print out text but the only thing that appears is the top row filled with boxes and the bottom row showing nothing..

I've read another forum talking about setting the LCD baud rate to my serial monitor rate, but i'm not sure how to do any of that. this is the product i bought: OSEPP - Multi Colored LED Assortment Set

here is my code.

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  lcd.clear();

}

void loop() {
  lcd.print("Hello World!");
  
}

Why do you use the pins: 12, 11, 5, 4, 3, 2 ?
The examples on that website use: 8, 9, 4, 5, 6, 7

Move the code that you have in loop() into setup() and leave loop blank between the braces (for now). Also, you don't need the lcd.clear in setup.

Don

Peter_n:
Why do you use the pins: 12, 11, 5, 4, 3, 2 ?
The examples on that website use: 8, 9, 4, 5, 6, 7

Good point.

My normal answer would be that you can use any available Arduino I/O pin for any of the LCD control or signal lines, but that is only true when you are doing the wiring between the two devices.

In this case the original poster did not tell us that he was using a shield. In that case the wiring between the two devices has already been done and your constructor (LiquidCrystal lcd(...)) must match that wiring.

My original comment about moving the code from loop() to setup() still stands.

Din

I've read another forum talking about setting the LCD baud rate to my serial monitor rate, but i'm not sure how to do any of that.

That information is not applicable in your case since you are not using a serial adapter between your Arduino and your LCD.

Don

did you attach a trim pot to adjust the contrast?

BulldogLowell:
did you attach a trim pot to adjust the contrast?

You haven't read the previous postings carefully, have you?

Such as the ones pointing out he is using a LCD and button shield.

Unfortunately this is one of the "bodgie" shields for which the warning at the top of this forum applies. It is all right as long as you never make pin 10 an output and write it HIGH - which also means you must not include it in the descriptor.

So if TheTurtleKing should still happen to be following,, his test code should be:

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  lcd.print("Hello World!");
}

void loop() {
}

Peter_n:
Why do you use the pins: 12, 11, 5, 4, 3, 2 ?
The examples on that website use: 8, 9, 4, 5, 6, 7

Thanks, this did help me get SOME output! :smiley: however i'm still having problems.

Paul__B:

BulldogLowell:
did you attach a trim pot to adjust the contrast?

You haven't read the previous postings carefully, have you?

Such as the ones pointing out he is using a LCD and button shield.

Unfortunately this is one of the "bodgie" shields for which the warning at the top of this forum applies. It is all right as long as you never make pin 10 an output and write it HIGH - which also means you must not include it in the descriptor.

So if TheTurtleKing should still happen to be following,, his test code should be:

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  lcd.print("Hello World!");
}

void loop() {
}

I got this.

just to be sure you will see what you expect, try to position the cursor and print:

void setup() 
{
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  lcd.print("Hello World!");
}

@turtle

Posting a monstrously huge picture is not necessary and posting any picture without specifying the code that produced it is usually a waste of time and bandwidth.

Is that the result of using the quoted code from Paul?

Don

@Bulldog

Positioning the cursor at (0,0) is not required since that is where it is positioned by the lcd.begin() function.

Also - this is only a code fragment not a complete sketch which may not be apparent to a beginner.

Don

floresta:
Also - this is only a code fragment not a complete sketch which may not be apparent to a beginner. [/color]

Don

gosh really?... its a code fragment? thanks, I'll try to remember

Did anybody notice the example code on this website that uses the LcdKeypad library (not included in OP's sketch) ?
http://osepp.com/products/shield-arduino-compatible/16x2-lcd-display-keypad-shield/

raschemmel:
Did anybody notice the example code on this website that uses the LcdKeypad library (not included in OP's sketch) ?
OSEPP - Multi Colored LED Assortment Set

I would have used their example code, however, I only want a very very basic example for me to work off of. I just want to have it display text.

floresta:
@turtle

Posting a monstrously huge picture is not necessary and posting any picture without specifying the code that produced it is usually a waste of time and bandwidth.

Is that the result of using the quoted code from Paul?

Don

no idea :frowning:

BulldogLowell:
just to be sure you will see what you expect, try to position the cursor and print:

void setup() 

{
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  lcd.print("Hello World!");
}

Tried this, and now it's broken again. back to square one.

AHH! I've got it working finally! :slight_smile:

thanks so much guys. you're so much help!

This is the code that sorted everything out!

// 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);

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!");
  delay(3000);
}

void loop() {
  lcd.clear();
  lcd.print("Test");
  delay(3000);
  lcd.clear();
  lcd.print("I'm Alive!");
  delay(3000);
}

The LCD suddenly stopped working out of the blue, now it's stuck on displaying "Test"

it was working just a second ago :frowning:

BulldogLowell:

floresta:
Also - this is only a code fragment not a complete sketch which may not be apparent to a beginner. [/color]

Don

gosh really?... its a code fragment? thanks, I'll try to remember

I guess you didn't comprehend the second half of the sentence.

Don