background image

 

VMA203 

V. 02 – 16/01/2019 

©Velleman nv 

6.

 

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 

Digital 10 

Backlight 

 

7.

 

Example 

 

//Sample using LiquidCrystal library 
#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; 
#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  
 // my buttons when read are centered at these valies: 0, 144, 329, 504, 741 
 // we add approx 50 to those values and check to see if we are close 
 if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be 
the most likely result 
 // For V1.1 us this threshold 
 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;   
 
 // For V1.0 comment the other threshold and use the one below: 
/* 
 if (adc_key_in < 50)   return btnRIGHT;   

Содержание VMA203

Страница 1: ...VMA203 LCD KEYPAD SHIELD FOR ARDUINO LCD1602 USER MANUAL ...

Страница 2: ...aning and user maintenance shall not be made by children without supervision Indoor use only Keep away from rain moisture splashing and dripping liquids 3 General Guidelines Refer to the Velleman Service and Quality Warranty on the last pages of this manual Familiarise yourself with the functions of the device before actually using it All modifications of the device are forbidden for safety reason...

Страница 3: ...g 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 Surf to www arduino cc and www arduino org for more information 5 Overview VMA203 The 16x2 LCD and keypad shield for Arduino Uno Mega Diecimila Duemilanove and Fr...

Страница 4: ...ine 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 my buttons when read are centered at these valies 0 144 329 504 741 we add approx 50 to those values and check to see if we are close if adc_key_in 1000 return btnNONE We make this the 1st option for speed reasons since it will be the most ...

Страница 5: ...ve 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 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...

Страница 6: ...s device For more info concerning this product and the latest version of this manual please visit our website www velleman eu The information in this manual is subject to change without prior notice COPYRIGHT NOTICE The copyright to this manual is owned by Velleman nv All worldwide rights reserved No part of this manual may be copied reproduced translated or reduced to any electronic medium or oth...

Страница 7: ...n shocks falls dust dirt humidity and by the article as well as its contents e g data loss compensation for loss of profits consumable goods parts or accessories that are subject to an aging process during normal use such as batteries rechargeable non rechargeable built in or replaceable lamps rubber parts drive belts unlimited list flaws resulting from fire water damage lightning accident natural...

Отзывы: