ARDUINO COOKBOOK 11.1; HD44780 Compatible

I have wired this as these instructions below; I tried pin 3 both through a 10k pot and also directly to 5v. The backlight is illuminated but the program also below doesn’t run?. Help please

Martyn

VSS GND Ground
VDD +5V Power
VO Potentiometer middle pin Controls contrast
RS 12 As per LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
E 11 Enable
D4 5 Data
D5 4 Data
D6 3 Data
D7 2 Data
A (LED+) +5V via 220Ω resistor Backlight anode
K (LED−) GND Backlight cathode
I received an insrtuction when submitting to format the code using the code link but it didn't do anything; guidance on this also would be appreciated please.
/*
 * LiquidCrystal Library - Hello World
 *

* Demonstrates the use of a 16 × 2 LCD display.

* https://www.arduino.cc/en/Tutorial/HelloWorld

*/

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

//constants for the number of rows and columns in the LCD

const int numRows = 2;

const int numCols = 16;

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()

{

lcd.begin(numCols, numRows);

lcd.print("Hello, World!"); // Print a message to the LCD.

}

void loop()

{

// set the cursor to column 0, line 1

// (row numbering starts with 0, so line 1 is the second row):

lcd.setCursor(0, 1);

// print the number of seconds since the sketch started:

lcd.print(millis()/1000);

}

What did you do with the WR pin on the LCD?
This pin should be connected to GND.

Write what you need to then press the < CODE/ > above and put your copied code in the place highlighted. It will look like this

Or use the IDE/Edit/Copy For Forum

Re-post your code using code tags, what you have is a mess and not worth the time to me and probably others to figure it out.

Hi @Sam1Bird2 !

Your application looks similar (though not identical in some details) to this Wokwi project

https://wokwi.com/projects/379103259377913857

You can easily take this existing project, change the pins and the wiring to fit to your setup and test it online.

If it works in the simulation it should work in reality also, if it does not work in reality then check your (real) wiring....

Good luck!

Thanks; I tried by highlighting and clicking code but nothing happened; directions to do this will be appreciated please.

Martyn

Connecting pin 3 directly to 5v will never work.

Connecting pin 3 to GND will frequently give a usable display.

Don

Thanks for all the inputs;

  1. I have reproduced the code from the arduino cookbook 11.1 below.
  2. I have also reproduced the wiring diagram from the cookbook.
  3. The 10k pot has been checked and functions; as best i can tell i have ranged it from 0 ohm to 10k ohm.
  4. Wiring has been double checked.

All I have is an illuminated sreen; whre to go from here please?

Thanks

Martyn

/*

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

// constants for the number of rows and columns in the LCDconst int numRows = 2;const int numCols = 16;
// initialize the library with the numbers of the interface pinsLiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(){lcd.begin(numCols, numRows);lcd.print("Hello, World!");  // Print a message to the LCD.}
void loop(){// set the cursor to column 0, line 1// (row numbering starts with 0, so line 1 is the second row):lcd.setCursor(0, 1);// compute seconds and print the number of seconds since the sketch started:unsigned long seconds = millis() / 1000;lcd.print(seconds);// clear any leftover digits if the number of digits shrinkslcd.print("   ");}

Thank you all for your patience and time; as you may have guessed it was the wiring; I shall stand in a corner with a dunce cap; Thanks again

Martyn

Actually you just passed the first test. So, move on to the next test!

Thanks :slightly_smiling_face:

Hy Martyn!

Don't worry ... every journey begins with the first step! If you continue to learn, you will turn any dunce cap

into a wizard's cap. Just make sure it doesn't say “Wizzard”:

Good luck and have fun!
ec2021

(And many thanks to one of my favourite writers: Terry Pratchett, RIP!)
Picture source: https://en.wikipedia.org/wiki/Rincewind

BTW: If you are satisfied with the result just mark this thread as solved by checking the box "Solution" of the post that finally helped you. So other members can see that this thread does not require support anymore!