lcd keypad shield

Good morning I'm a beginner, I need to connect my LCD keypad shield in my arduino MEGA 2560. Could someone give me a hand with the wiring (if possible with an attached photo) and the code because I tried different solutions, but I can't seem to get it work.

Please tell us what you've tried already.

I’ve already try to connect the lcd like an conventional lcd display
(RS → 6 ,E–>7,D0–>8,D1—>9 ,D2—>10,D3–>11) , but
it does not work and i’ve tryed to connect the button in A0

Please explain exactly what you mean by "it does not work".

Please post a link to where you bought the shield from. Use the chain links icon on the toolbar to make the URL clickable.

Typically, to connect a lcd keypad shield to a Mega2560 you just plug it in. I'm not sure what you are really asking help with.

You may want to have a read of the sticky about LCD keypads in this (Display) section.

--- bill

  1. as bperrybap mentioned, simply install the shield. there are however a couple of things you also need to do.
  2. define as follows:
    LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 ); you don’t have to connect any wires to do this. it’s builtin to the shield.
    const int lcd_key_pin = A0; use A0 to read the buttons. again no wiring required - it’s builtin
  3. attach a potentiometer this you will have to wire
    use 5v and gnd(just to the right of 5v), both on the bottom of the shield near the rst button.
    use V0 for the center pin of the pot. V0 is at top left of the shield
    i’m using a 10k-ohm from radio shack #2711721. in the likely event that you can’t find a rs still open near you, i’m pretty sure any similar pot will do.

here’s a code example for reading the buttons. may, or may not, fit your application. but, a decent example. btw, the rst button is a board (mega) reset, soft reboot. no value is returned for this button.

// read the buttons
int read_LCD_buttons( void ) {

key_in = 901; // set starting point for each iteration. indicates no button
do {
key_in = analogRead( lcd_key_pin ); // read the value from the sensor
} while( key_in >= 900 ); // wait for a/any button press

// return values from buttons are approxomately these for each button: ±5 to 10
// – right : 35
// – up : 158
// – down : 324
// – left : 486
// – select : 711

// we play “the price is right” and try to pick the closest number without going “under”
if( key_in < 50 )
return c_s_right;
if( key_in < 200 )
return c_s_up;
if( key_in < 350 )
return c_s_down;
if( key_in < 500 )
return c_s_left;
if( key_in < 750 )
return c_s_select;

return c_s_none; // when all others fail, return this

good luck