How to Use an LCD - Arduino
by Hugo Trombert in Circuits > Arduino
3716 Views, 54 Favorites, 0 Comments
How to Use an LCD - Arduino
Let's learn how to use an LCD (Liquid Crystal Display) with an Arduino board.
Hardware Needed
-An Arduino Uno
-A breadboard
-Jumper wires
-A 10K potentiometer
-And an LCD of course !
You won't need any tool.
Build the Circuit
The steps here correspond to the image above...
First, pin your LCD on the breadboard and power the breadboard by connecting a wire from "5V" (power) on your Arduino to the positive row on the breadboard and another one from "GND" (ground or 0V) to the negative row.
Then connect the LCD to the Arduino:
LCD pin 4 - Arduino pin 2
Pin 6 - pin 3
Pin 11 - pin 4
Pin 12 - pin 5
Pin 13 - pin 6
Pin 14 - pin 7
After that, power the LCD:
LCD pin 1 = GND on the breadboard
Pin 2 = 5V
Pin 5 = GND
Pin 15 = 5V
Pin 16 = GND
Then connect pin 3 on your LCD to the central pin of the 10K potentiometer.
Finally, power the potentiometer with one pin on GND and the other one on 5V (on the breadboard).
Code
Now let's write the code...
#include <LiquidCrystal.h> //Include the library that enables you to use the LCD.
LiquidCrystal lcd(2,3,4,5,6,7);//Declare that your LCD is connected to pins 2,3,4,5,6 & 7 on your arduino.
void setup() { lcd.begin(16, 2);//16 by 2 are the dimensions of the LCD (in number of characters) lcd.print("My name is Bond");//print "My name is Bond," on the LCD lcd.setCursor(0, 1); //break a line lcd.print("controlled LCD!");//print "James Bond" on the second line of the LCD. } void loop() { }