What You Will Learn
1602 Arduino LCD Keypad Shield Features
Displaying information in electronic projects has always been the most compelling issue. There are various ways to display data. These screens can be so simple such as 7segments or LEDs, or they can be more fascinating such as LCDs. Using LCDs has always been one of the most popular ways to display information. LCDs are divided into two generic types: Characters and Graphics.
One of the most common, cheapest and simplest LCDs available is the character LCD. This LCD consists of several rows and columns. Letters and numbers are written in places created by rows and columns. For example, LCD character 16*2 has 2 rows and 16 columns. So it can display 32 characters.
Working with these LCDs is very simple and they have full compatibility with all microcontrollers and processor boards. For easier use of these LCDs, its 16x2model, including four keys for making the menu, is made as a Shield which is also compatible with Arduino boards.
How to Use Arduino LCD Keypad Shield
|Arduino Pin||Shield Pin|
How to Read the Keys?
In this shield, all 4 keys are connected to the analog pin 0 to save on digital pins. So we should use ADC to read them. When you press a key, it returns a value to the A0 pin according to the internal resistive splitting circuit, which identifies the type of the key.
/* Arduino 2x16 LCD - Detect Buttons modified on 18 Feb 2019 by Saeed Hosseini @ Electropeak
Let’s take a deeper look at the code:
The library you need for character LCD.
LiquidCrystal LCD( pin_RS, pin_EN, pin_d4, pin_d5, pin_d6, pin_d7);
Defining the LCD object according to the pins that are connected to Arduino.
|lcd.clear();||Clear LCD screen|
|lcd.print(data);||Display informations in string or number|
|lcd.setCursor(col,row);||Change the start point position|
|lcd.scrollDisplayLeft();||Shift the cursor one block to the left|
|lcd.scrollDisplayRight();||Shift the cursor one block to the right|
|lcd.creatChar(num,data);||Create a desired character(character number,character string)|
How to Scroll a Text?
/* Arduino 2x16 LCD - LCD Scroll modified on 18 Feb 2019 by Saeed Hosseini
How to Display a Specific Character?
/* Arduino 2x16 LCD - LCD Special Char modified on 18 Feb 2019 by Saeed Hosseini
lcd.createCharstores your array in a memory location and you can display it with
Example Projects for LCD Keypad Shield
- Try to create a menu with ability of selecting options.