LCD+keypad shield not working


i have combination of lcd+keypad shield , uno smd. whatever try nothing seen on lcd. can tell me i'm doing wrong.


the parts use:
http://hackerstore.nl/artikel/9
http://hackerstore.nl/artikel/685

the code use:

//sample using liquidcrystal library
#include <liquidcrystal.h>
 
/*******************************************************
 this program test lcd panel , buttons
 mark bramwell, july 2010
 ********************************************************/
 
// select pins used on lcd panel
liquidcrystal lcd(8, 9, 4, 5, 6, 7);
 
// define values used panel , 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 buttons
int read_lcd_buttons()
{
 adc_key_in = analogread(0);      // read value sensor
 // buttons when read centered @ these valies: 0, 144, 329, 504, 741
 // add approx 50 values , check see if close
 if (adc_key_in > 1000) return btnnone; // make 1st option speed reasons since result
 // v1.1 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;
 
 // v1.0 comment other threshold , use 1 below:
/*
 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 others fail, return this...
}
 
void setup()
{
 lcd.begin(16, 2);              // start library
 lcd.setcursor(0,0);
 lcd.print("push buttons"); // print simple message
}
 
void loop()
{
 lcd.setcursor(9,1);            // move cursor second line "1" , 9 spaces over
 lcd.print(millis()/1000);      // display seconds elapsed since power-up
 
 
 lcd.setcursor(0,1);            // move begining of second line
 lcd_key = read_lcd_buttons();  // read buttons
 
 switch (lcd_key)               // depending on button pushed, perform action
 {
   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;
     }
 }
 
}

one obvious question how lcd wired ?  shield use same pins code ?
does simple test work ?
code: [select]

#include <liquidcrystal.h>

liquidcrystal lcd(8, 9, 4, 5, 6, 7);

void setup()
{
  lcd.begin(16, 2);              // start library
  lcd.setcursor(0, 0);
  lcd.print("test lcd");         // print simple message
}

void loop()
{
}

do error messages when uploading arduino ?


Arduino Forum > Using Arduino > Programming Questions > LCD+keypad shield not working


arduino

Comments