Table of Contents
Earlier you learn Interfacing of LCD with Arduino and then LCD begin & how to set Cursor of LCD to display, Now you will learn how to display text or string on LCD 16×2 using Arduino, for this, we will use LCD function print.
Syntax: object.print(“ Text to print ”);
S.N. | Arduino Pin | LCD pin | |
---|---|---|---|
1. | 1. VSS | Ground (0V) | |
2. | 2. VCC | + 5V | |
3. | 3. VEE | 10K POT | |
4. | 2 | 4. RS | |
5. | 5. RW | Ground | |
6. | 3 | 6. E | |
7. | 7. D0 | - | |
8. | 8. D1 | - | |
9. | 9. D2 | - | |
10. | 10. D3 | - | |
11. | 4 | 11. D4 | |
12. | 5 | 12. D5 | |
13. | 6 | 13. D6 | |
14. | 7 | 14. D7 | |
15. | 15. Anode + | + 5V | |
16. | 16. Cathode - | 0V (Ground) |
CIRCUIT DIAGRAM
* POT = Potentiometer = Variable resistor
ARDUINO CODE TO DISPLAY STRING ON LCD 16×2
#include <LiquidCrystal.h> LiquidCrystal lcd(2, 3, 4, 5, 6, 7); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // set up cursor at top left lcd.setCursor(0, 0); lcd.print("HELLO"); // set up cursor at bottom left lcd.setCursor(0, 1); lcd.print("WORLD"); } void loop() { }
CONFIGURING LCD 16×2 IS IMPORTANT
After uploading the code to the Arduino, maybe no content visible in this case we need to vary the variable resistance (POT) 10 KΩ, by varying this resistance you can see the printed string on the LCD screen. The variable resistor is used because in different climatic conditions different values of resistance can make display properly.
OUTPUT
READ NEXT
SCROLL DATA ON LCD 16×2 USING ARDUINO