4

I am using the following wiring diagram from a tutorial. I need to follow this configuration because later tutorials build on this example. I have looked at other solutions, but they follow a different pattern and I am still learning, so don't have the sophistication to adapt. I've looked at:

Hacktronics StackExchange

The picture shows Freeduino, but I am using an Arduino Uno (does that make a difference?) Connection Diagram

Here is the code I am using:

#include <LiquidCrystal.h>
int rs = 3;
int enable = 4;
int d4 = 5;
int d5 = 6;
int d6 = 7;
int d7 = 8;

int rows = 2;
int cols = 16;
LiquidCrystal lcd (3, 4, 5, 6, 7, 8);

void setup() {
  // put your setup code here, to run once:
  pinMode (rs, OUTPUT);
  pinMode (enable, OUTPUT);
  pinMode (d4, OUTPUT);
  pinMode (d5, OUTPUT);
  pinMode (d6, OUTPUT);
  pinMode (d7, OUTPUT);
  lcd.begin(cols, rows);
  lcd.clear();
}

void loop() {
  // put your main code here, to run repeatedly:
  lcd.setCursor(0,0);
  lcd.print("Hello World");
  delay(1000);
  lcd.setCursor(0,1);
  lcd.print("Goodbye World");
  delay(1000);
}

Unfortunately, I am getting a blank screen (it is lit up, but blank). So questions:

  1. Is the diagram correct?

  2. Is the code the problem?

  3. What else should I look for?

Chiwda
  • 252
  • 1
  • 3
  • 11

2 Answers2

1

1) Diagram seems to be fine. However we don't see pin numbering on LCD. Sometimes pins are like: 15 16 1 2 3 4 ... 14 (at least pin 1 is usualy marked).

2) Library should take care of inputs or outputs. So you can remove pinModes for them. Also change variables to constant variables and use them for lcd initialization: LiquidCrystal lcd(rs, enable, d4, d5, d6, d7);

3) Potentiometer in diagram is contrast setting. You have to preset correct value for it. Start with everything is black and find value where this black is almost invisible. If you've something displayed on LCD, it would be even easier to find right position as text just shows up.

Edit: I've just tested it and it's working fine. With the same wiring and contrast pot adjusted to the right position

RS2322016
  • 384
  • 1
  • 3
  • 12
KIIV
  • 4,907
  • 1
  • 14
  • 21
1

Check the voltage. your LCD should get 5v to work properly.

if you are powering it through your computer USB, Arduino could be outputting less than 5v.

PS: it happened to me yesterday.

dsncode
  • 131
  • 5