Introduction: Coding an Lcd Display With Arduino
In this tutorial, I will show you the basic Arduino code for an LCD display.
Including the functions:
Step 1: The LiquidCrystal Library
To code an LCD, your going to have to include the LiquidCrystal library.
To do that:
- Click on the "Sketch" button on the top of the application (see picture)
- Click the "Ïnclude Library" Button (see picture)
- Click on "LiquidCrystal" (see picture)
Step 2: Input Pins
The next step is to initialize the library with input pins (12, 11, 5, 4, 3, 2).
To do that type: LiquidCrystal lcd(12, 11, 5, 4, 3, 2). (see picture)
Step 3: Rows and Columns
Now I'm going to show you how to set the rows and columns for your LCD display.
Under void setup() type: lcd.begin(16,2) (see picture)
This will set the LCD to 16 columns by 2 rows.
Step 4: Print a Message
To print a message on the LCD display type:
lcd.print("Your Message Here") (see picture)
Make sure you type this on the line under lcd.begin, or it will pull up an error message when you try to verify the code.
Step 5: Other Code
Other code you can use in the future includes
lcd.setCursor(0,1) //Prints the text in a different place.
lcd.clear() //Clears the LCD display
Comment any questions below and I'll be happy to answer them for you! Thanks for Reading!