LCD Keypad Shield V2 for Arduino
This product includes a 2x16 LCD display and 6 momentary push buttons. Pins 4, 5, 6, 7, 8, 9 and 10 are used to interface with the LCD and Analog Pin 0 is used to read the work status of five pushbuttons. Menu selection and monitoring can be easily achieved by this product even for gaming. LCD Keypad Shield V2.0 is a sepcial version based on LCD Keypad shield V1.0. A simple Arduino library is provided to make screen driving easier. It is only compatible with 5V Arduino boards, such as Arduino UNO, Arduino Leonardo and Arduino Mega.
Quick Spec
- Operating Voltage: 5V
- Drive Pin: D4~D10
- 5 KEYS input
- Module size: 54*84mm
- 1602 blue background liquid crystal (16x2)
Sample Code
#include <LiquidCrystal.h>
// Select the pin used on LCD
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// define the button
int lcd_key = 0;
int adc_key_in = 0;
#define btnRIGHT 0
#define btnUP 1
#define btnDOWN 2
#define btnLEFT 3
#define btnSELECT 4
#define btnNONE 5
//read the button value
int read_LCD_buttons()
{
adc_key_in = analogRead(0); // read analog A0 value
// when read the 5 key values in the vicinity of the following:0,144,329,504,741
// By setting different threshold, you can read the one button
if (adc_key_in > 1000) return btnNONE;
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 250) return btnUP;
if (adc_key_in < 450) return btnDOWN;
if (adc_key_in < 650) return btnLEFT;
if (adc_key_in < 850) return btnSELECT;
// V1.0 Use the following version threshold:
/*
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT;
if (adc_key_in < 790) return btnSELECT;
*/
return btnNONE;
}
void setup()
{
lcd.begin(16, 2); // star
lcd.setCursor(0,0);
lcd.print("Push the buttons"); // display“Push the buttons”
}
void loop()
{
lcd.setCursor(9,1); // The cursor is set at second. and have 9 spaces
lcd.print(millis()/1000); // Output waiting time
lcd.setCursor(0,1); // The cursor moves to the beginning of the second line.
lcd_key = read_LCD_buttons(); // read key
switch (lcd_key) // display key
{
case btnRIGHT:
{
lcd.print("RIGHT ");
break;
}
case btnLEFT:
{
lcd.print("LEFT ");
break;
}
case btnUP:
{
lcd.print("UP ");
break;
}
case btnDOWN:
{
lcd.print("DOWN ");
break;
}
case btnSELECT:
{
lcd.print("SELECT");
break;
}
case btnNONE:
{
lcd.print("NONE ");
break;
}
}
}
Resources
Shipping List
- 1 x LCD Keypad Shield V2 for Arduino
LCD Keypad Shield V2 for Arduino
- Brand: DF Robot
- Product Code: DFR0374
- Product Status : Active
Stock
Warehouse | Stock Status | Location |
---|---|---|
Centurion | No Stock | |
Stellenbosch | Limited Stock | Z1035 |
We ship free of charge between branches to complete your order.
-
R210.00 (Inc Tax: R241.50)
Related Products
Adafruit 16x2 Shield with Keypad Kit, White on Blue Background, for Raspberry Pi
Adafruit Blue & White 16x2 LCD + Keypad Kit For Raspberry Pi This new Adafruit Pi plate makes it easy to use a blue and white 16x2 character LCD . Unfortunately, these LCDs do require quite a f..
R399.00 (Inc Tax: R458.85)
RGB Display & Keypad for Pi - I2C
RGB Display & Keypad for Pi - I2C This is a 2x16 character RGB LCD with Keypad plate for Raspberry Pi. DF Robot have made improvements in the wiring connection based on the previous LCD display..
R168.00 (Inc Tax: R193.20)
Tags: lcd, lcd shield, shield, df robot, v2