2

I would like to know what I've done wrong. I configured my circuit using the "Hello world tutorial. I got the infamous white square pattern

  • D7 to pin 2
  • D6 to pin 3
  • D5 to pin 4
  • D4 to pin 5
  • E to pin 11

My code:

// include the library code:
#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7); LiquidCrystal lcd(2, 3, 4, 5, 11, 12); // put your pin numbers here

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, 0); // print the number of seconds since reset: lcd.print("hello, world!"); }

the infamous squares

Mat
  • 464
  • 1
  • 4
  • 8
  • 1
    The description of the pin map does not seem to match your call legend in the lcd constructor on line. It is difficult to tell what you have wired without the right angle on the LCD module. In particular to see RS and RW wiring. Complete pictures of wiring are helpful. This would include wiring to the Arduino, because frankly we all screw this stuff up. – timemage Nov 15 '20 at 19:04
  • it appears that in the picture you do not have the ground connected – jsotola Nov 15 '20 at 22:17
  • @jsotola, it looked to me that she did, only it was a red lead. – timemage Nov 15 '20 at 22:23
  • What's connected to V0 on the display? Where's your 10K trimpot so you can adjust the contrast (by changing the voltage between 0 and Vcc) until the "infamous" white squares vanish. – Dougie Nov 15 '20 at 22:28
  • @Dougie contrast is set correctly. The first line should show squares, and the second line is empty, on powerup. – Gerben Nov 16 '20 at 19:14

2 Answers2

1

Your picture does not give a clear view of the connections between the Arduino Uno and the LCD module. However, if we are to follow your description of your connections ...

D7 to pin 2
D6 to pin 3
D5 to pin 4
D4 to pin 5
E to pin 11

... and we assume D7, D6, D5 & D4 are pins on the LCD, then we see that the code is incorrect ...

LiquidCrystal lcd(2, 3, 4, 5, 11, 12);      // put your pin numbers here

... given the LiquidCrystal description here of the syntax of the overloaded (means there are more than one pattern to the passed parameters to the identically named constructor) class ...

Syntax

LiquidCrystal(rs, enable, d4, d5, d6, d7) LiquidCrystal(rs, rw, enable, d4, d5, d6, d7) LiquidCrystal(rs, enable, d0, d1, d2, d3, d4, d5, d6, d7) LiquidCrystal(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)

... instead, try:

LiquidCrystal lcd(?, 11, 5, 4, 3, 2);      // put your pin numbers here

... as you didn't tell us how you connected the RS line I have left that value above as a "?". So this will not compile until you fill in the missing information.

It should be added, based on what can be seen in the picture, that a connection has been made to the LCD's RS & RW pins and no connection has been made to the LCD's E (enable) pin. But in all the constructor's overloaded versions, there is always an E (enable) pin. Please take a closer look at your design to determine if this is a problem.

st2000
  • 7,343
  • 2
  • 11
  • 19
0

In my case the issue was trivial: the LCD pins were not making good contact with the breadboard.

By firmly inserting them and reuploading you should be able to see "hello world!"

Rexcirus
  • 253
  • 2
  • 8