WHADDA WPSH203 LCD and Keypad Shield for Arduino User Manual
- June 4, 2024
- WHADDA
Table of Contents
- Introduction
- Safety Instructions
- General Guidelines
- What is Arduino®
- Product Overview
- Specifications
- Features
- Pin Layout
- Example
- include <LiquidCrystal.h>
- define btnRIGHT 0
- define btnUP 1
- define btnDOWN 2
- define btnLEFT 3
- define btnSELECT 4
- define btnNONE 5
- References
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
WPSH203 LCD and Keypad Shield for Arduino
User Manual
Introduction
To all residents of the European Union
Important environmental information about this product
This symbol on the device or the package indicates that disposal of the device
after its lifecycle could harm the environment. Do not dispose of the unit (or
batteries) as unsorted municipal waste; it should be taken to a specialized
company for recycling. This device should be returned to your distributor or
to a local recycling service. Respect the local environmental rules.
If in doubt, contact your local waste disposal authorities.
Thank you for choosing Whadda! Please read the manual thoroughly before bringing this device into service. If the device was damaged in transit, do not install or use it and contact your dealer.
Safety Instructions
Read and understand this manual and all safety signs before using this
appliance.
For indoor use only.
- This device can be used by children aged 8 years and above, and persons with reduced physical, sensory or mental capabilities or lack of experience and knowledge if they have been given supervision or instruction concerning the use of the device in a safe way and understand the hazards involved. Children shall not play with the device. Cleaning and user maintenance shall not be made by children without supervision.
General Guidelines
- Refer to the Velleman® Service and Quality Warranty on the last pages of this manual.
- All modifications of the device are forbidden for safety reasons. Damage caused by user modifications to the device is not covered by the warranty.
- Only use the device for its intended purpose. Using the device in an unauthorized way will void the warranty.
- Damage caused by disregard of certain guidelines in this manual is not covered by the warranty and the dealer will not accept responsibility for any ensuing defects or problems.
- Nor Velleman Group NV nor its dealers can be held responsible for any damage (extraordinary, incidental, or indirect) – of any nature (financial, physical…) arising from the possession, use, or failure of this product.
- Keep this manual for future reference.
What is Arduino®
Arduino® is an open-source prototyping platform based on easy-to-use hardware and software. Arduino® boards are able to read inputs – a light-on sensor, a finger on a button, or a Twitter message – and turn them into an output – activating a motor, turning on an LED, or publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so, you use the Arduino programming language (based on Wiring) and the Arduino® software IDE (based on Processing). Additional shields/modules/components are required for reading a Twitter message or publishing online. Surf to www.arduino.cc for more information.
Product Overview
The 16×2 LCD and keypad shield for Arduino® Uno, Mega, Diecimila, Duemilanove, and Freeduino boards.
1 | LCD contrast potentiometer | 3 | control keys (connected to analog input 0) |
---|---|---|---|
2 | ICSP port |
Specifications
- dimensions: 80 x 58 x 20 mm
Features
- blue background/white backlight
- screen contrast adjustment
- uses 4-bit Arduino® LCD library
- reset button
- the Up, Down, Left, and Right buttons use only one analog input
Pin Layout
Analogue 0 | UP, DOWN, RIGHT, LEFT, SELECT |
---|---|
Digital 4 | DB4 |
Digital 5 | DB5 |
Digital 6 | DB6 |
Digital 7 | DB7 |
Digital 8 | RS |
Digital 9 | E |
Digital 10 | Backlight |
Example
*/
include <LiquidCrystal.h>
/***
This program will test the LCD panel and the buttons
****/
// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// define some values used by the panel and buttons
int lcd_key = 0;
int adc_key_in = 0;
unsigned char message_count = 0;
unsigned long prev_trigger = 0;
define btnRIGHT 0
define btnUP 1
define btnDOWN 2
define btnLEFT 3
define btnSELECT 4
define btnNONE 5
// read the buttons
int read_LCD_buttons()
{
adc_key_in = analogRead(0); // read the value from the sensor
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; // when all others fail, return this…
}
void setup()
{
lcd.begin(16, 2); // start the library
lcd.setCursor(0,0);
lcd.print(“Whadda WPSH203”); // print a simple message
}
void loop()
{
lcd.setCursor(9,1); // move cursor to second line “1” and 9 spaces over
lcd.print(millis()/1000); // display seconds elapsed since power-up
lcd.setCursor(0,1); // move to the begining of the second line
lcd_key = read_LCD_buttons(); // read the buttons
switch (lcd_key) // depending on which button was pushed, we perform an action
{
case btnRIGHT:
{
lcd.print(“RIGHT “); // Print RIGHT on LCD screen
// Code to increase message counter after debounced button press
if((millis() – prev_trigger) > 500) {
message_count++;
if(message_count > 3) message_count = 0;
prev_trigger = millis();
}
/////////////////////////////////////////////////////////////
break;
}
case btnLEFT:
{
// if You need the word “LEFT ” shown on the display than use lcd.print(“LEFT
“) instead of lcd.print(adc_key_in) and lcd.print(” v”);
// the following 2 lines will print the actual threshold voltage present at
analog input 0; As these buttons are part of a voltage divider, pressing each
button creates a different threshold voltage
lcd.print(adc_key_in); // shows the actual threshold voltage at analog input 0
lcd.print(” v”); // ends with v(olt)
// Code to decrease message counter after debounced button press
if((millis() – prev_trigger) > 500) {
message_count–;
if(message_count == 255) message_count = 3;
prev_trigger = millis();
}
/////////////////////////////////////////////////////////////////
break;
}
case btnUP:
{
lcd.print(“UP “); // Print UP on LCD screen
break;
}
case btnDOWN:
{
lcd.print(“DOWN “); // Print DOWN on LCD screen
break;
}
case btnSELECT:
{
lcd.print(“SELECT”); // Print SELECT on LCD screen
break;
}
case btnNONE:
{
lcd.print(“TEST “); // Print TEST on LCD screen
break;
}
}
// If a button was pressed, check if a different message needs to be displayed
if(lcd_key != btnNONE) {
lcd.setCursor(0,0);
switch(message_count)
{
case 0: {
lcd.print(“Whadda WPSH203 “);
break;
}
case 1: {
lcd.print(“LCD shield “);
break;
}
case 2: {
lcd.print(“Check whadda.com”);
break;
}
case 3:{
lcd.print(“Velleman “);
break;
}
}
lcd.setCursor(0,1); // reset LCD cursor to the 2nd row (index 1)
}
}
Modifications and typographical errors reserved – © Velleman Group NV.
WPSH203_v01
Velleman Group nv, Legen Heirweg 33 – 9890 Gavere.
References
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>