LCD Preparation: When you first take an LCD out of the box, you can't immediately hook it up to your Arduino; you have to solder on header pins first. You can either just solder in the pins and connect it to a breadboard, or you can make the LCD self-sufficient by connecting wires to the header pins, as in this tutorial.
LCD Set-up: The LCD has 14 pins. For these tutorials, we're only going to be using 4 bits, which means we only need to use 10 of the pins. Use the guide below or on this site:
Pin 1 (Vss/GND): GND pin on Arduino and potentiometer
Pin 2 (Vcc/5 V): 5V pin on Arduino and potentiometer
Getting started: Before you start making new sketches, first test your LCD to make sure it works. The Arduino program has built-in sketches for LCDs; go to File > Examples > LiquidCrystal and load HelloWorld onto your Arduino. If nothing shows up on your LCD, try twisting the potentiometer to change the contrast.
Initializing: For this tutorial, we're essentially modifying one of the example sketches already present in the Arduino library. First, import the LiquidCrystal library and initialize your LCD with the correct pin numbers. Also, choose and store a String to scroll across your LCD.
Setup: Set up your LCD with the command lcd.begin(16, 2). This tells the program that you're using an LCD with 16 columns and 2 rows. Then print your string to the display. Delay for a bit to ensure the string prints correctly.
Scroll string: To scroll our string, we need to know how many spaces it needs to move. Inside your loop method, initialize a variable to store the total number of spaces you're using: 16 columns + the length of your string. Then, set up a for loop that will run the same number of times. Each time through the loop, call the lcd.scrollDisplayLeft() method to move your message over one space. Delay to ensure your message doesn't skip around so quickly you miss it. Congratulations; you have a scrolling message!
Experiment: Arduino comes with plenty of built-in commands for LCDs. Try scrolling right instead of left, or scroll back and forth. Can you make your message blink, move to the second row, or count up each time it goes across?