How to Use LCD Keypad Shield for Arduino

In this tutorial, we will learn on how to use the LCD Keypad Shield for Arduino. This shield is compatible for Arduino Uno and Arduino Mega.

From this pin assignments, we can conclude that the following pins are free and available to be use for other purposes.

Digital pins: 0, 1, 2, 3, 11, 12, and 13. Analog pins: A1 to A5.

 1#include "LiquidCrystal.h"
 2
 3LiquidCrystal lcd( 8,  9,  4,  5,  6,  7);
 4
 5void setup() {
 6 lcd.begin(16, 2);
 7 lcd.setCursor(0,0);
 8 lcd.print("  TechToTinker  ");
 9 lcd.setCursor(0,1);
10 lcd.print("Press Key:");
11}
12
13void loop() {
14 int x;
15 x = analogRead (0);
16 lcd.setCursor(10,1);
17 
18 if (x < 60) {
19   lcd.print ("Right ");
20 }
21 else if (x < 200) {
22   lcd.print ("Up    ");
23 }
24 else if (x < 400){
25   lcd.print ("Down  ");
26 }
27 else if (x < 600){
28   lcd.print ("Left  ");
29 }
30 else if (x < 800){
31   lcd.print ("Select");
32 }
33} 
...
cpp

If you find this tutorial helpful, like and share this to your friends who might benefit from it. Thank you and have a good day.



Posts in this series



GitHub-flavored Markdown & a sane subset of HTML is supported.