User Manual
155
/
223
The LCD display needs six Arduino pins, all set to be digital outputs. It also needs 5V
and GND connections.
There are a number of connections to be made. Lining up the display with the top
of the breadboard helps to identify its pins without too much counting, especially if
the breadboard has its rows numbered with row 1 as the top row of the board. Do
not forget, the long yellow lead that links the slider of the pot to pin 3 of the display.
The 'pot' is used to control the contrast of the display.
You may find that your display is supplied without header pins attached to it. If so,
follow the instructions in the next section.
Code
After wiring, please open the program in the code folder- Lesson 22 LCD Display and
click UPLOAD to upload the program. See Lesson 2 for details about program
uploading if there are any errors.
Before you can run this, make sure that you have installed the < LiquidCrystal >
library or re-install it, if necessary. Otherwise, your code won't work.
For details about loading the library file, see Lesson 1.
Upload the code to your Arduino board and you should see the message 'hello,
world' displayed, followed by a number that counts up from zero.
The first thing of note in the sketch is the line:
#include <LiquidCrystal.h>
This tells Arduino that we wish to use the Liquid Crystal library.
Next we have the line that we had to modify. This defines which pins of the Arduino
are to be connected to which pins of the display.
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
After uploading this code, make sure the backlight is lit up, and adjust the
potentiometer all the way around until you see the text message
In the 'setup' function, we have two commands:
lcd.begin(16, 2);
lcd.print("Hello, World!");
The first tells the Liquid Crystal library how many columns and rows the display has.
The second line displays the message that we see on the first line of the screen.
In the 'loop' function, we aso have two commands:
lcd.setCursor(0, 1);
lcd.print(millis()/1000);










