Code
After wiring, please open the program in the code folder- Lesson 14 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
This tells Arduino that we wish to use the Liquid Crystallibrary.
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 also have two commands:
lcd.setCursor(0, 1);
lcd.print(millis(/1000);
101/162
The first sets the cursor position (where the next text will appear) to column 0 &
row 1. Both column and row numbers start at 0 rather than 1.
The second line displays the number of milliseconds since the Arduino was reset