No works Keypas LCD Shield for Arduino UNO rv3

Hello :

I bought Arduino UNO Keypad and LCD Shield.

I tried to see if codes displays messages but does not tell me neither “Hello.”
I only listed one line above the LCD .
Codes I have tried and none give me answer. I want to know if the code is broken or the LCD .

Example 1 :

# include <LiquidCrystal.h>
LiquidCrystal milcd ( 12, 11 , 5, 4, 3 , 2) ;
smiley byte [ 8] = { B00000 , B10001 , B00000 , B00000 , B10001 , B01110 , B00000 } ;

void setup () {
        milcd.createChar ( 0 , smiley );
        milcd.begin ( 16 , 2) ;
        milcd.write ( 0 ) ;
}

void loop () { }

Example 2 :

# include <LiquidCrystal.h>
LiquidCrystal milcd ( 12, 11 , 5, 4, 3 , 2) ;

void setup () {
      milcd.begin (16.2) ;
      milcd.print ("Hello" );
}

void loop () {
      milcd.setCursor (0.1 ) ;
      milcd.print ( millis () / 1000) ;
}

Example 3 :

# include <LiquidCrystal.h>
LiquidCrystal milcd ( 12, 11 , 5, 4, 3 , 2) ;
luzFondo int = 13 ;

void setup () {
     pinMode ( luzFondo , OUTPUT) ;
     digitalWrite ( luzFondo , HIGH);
     lcd.begin (20.4) ;
     Serial.begin ( 9600 ) ;
}

void loop () {
     if ( Serial.available ()> 0) {
            delay (100 );
            lcd.clear ( ) ;
            while ( Serial.available ()> 0) {
                 lcd.write ( Serial.read ());
            }
     }
}

Is there any solution ?

Best regards .

Hi.

I have a LCD Keypad shield that looks just like that.
It has the same syntax error (the word “rigth”) and solder jumpers on it.
Where did you find instructions to use “LiquidCrystal milcd ( 12, 11 , 5, 4, 3 , 2) ;” for this display ?

I found that this works for mine:

/*
  The circuit:
 * LCD RS pin to digital pin 8
 * LCD Enable pin to digital pin 9
 * LCD D4 pin to digital pin 4
 * LCD D5 pin to digital pin 5
 * LCD D6 pin to digital pin 6
 * LCD D7 pin to digital pin 7
 * LCD BL pin to digital pin 10
 * KEY pin to analog pin 0        (14)  THIS IS THE BUTTON PIN
 */

#include <LiquidCrystal.h>

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

char msgs[5][16] = {"Right Key OK ",
                    "Up Key OK    ",               
                    "Down Key OK  ",
                    "Left Key OK  ",
                    "Select Key OK" };

//int adc_key_val[5] ={1, 150, 500, 350, 800 }; // 1st change
//int adc_key_val[5] ={800, 500, 350, 150, 50 }; // Original inverted order
int adc_key_val[5] ={50, 200, 400, 600, 800 }; //Original, works after actually reading the analog0

//int adc_key_val[5] ={ 0, 133, 308, 482, 723 };// Had  to change the order of the keys to have them show up correct.
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;

void setup()
{
    Serial.begin(9600);
  lcd.clear(); 
  lcd.begin(16, 2);
  lcd.setCursor(0,0); 
  lcd.print("ADC key testing"); 
}

void loop()
{ //1

 key = (analogRead (0));
 //Serial.println(analogRead(0));
  if (key != oldkey)   // if keypress is detected "!=" means not equal!!
   {//2
    delay(50);  // wait for debounce time
    adc_key_in = analogRead(0);    // read the value from the sensor 
    key = get_key(adc_key_in);    // convert into key press
    if (key != oldkey)    
    {//3   
      lcd.setCursor(0, 1);
      oldkey = key;
      if (key >=0){//4
           lcd.print(msgs[key]);
      Serial.println(key); 
      Serial.println(analogRead(0));
      
      if (key == 308)
 {
  Serial.println("            down  ");
 }
      
      
lcd.setCursor(15,1);  
lcd.print(key);

      }//4
    }//3

   }//2
  /*
 if (key = 800)
 {
   delay(2000);
   lcd.clear();
  }
*/
 delay(100);
 
}//1

// Convert ADC value to key number
int get_key(unsigned int input)
{
    int k;
   
    for (k = 0; k < NUM_KEYS; k++)
    {
      //if (input == adc_key_val[k]) //works
      if (input < adc_key_val[k]) // should be more reliable as it doesn't looks for a range instead of a fixed value but it isn't
 {
            return k;
        }
   }
   
    if (k >= NUM_KEYS)k = -1;  // No valid key pressed
    return k;
}

It is a sketch that tests the keys, and displays what keypresses are detected.
I did change something here, i made it look for a range instead a fixed value for the keypresses.
That will allow some deviation and hopefully get a more reliable read of those keypresses.

You also need to read the warning (click !) on top of this section of the forum, it does apply to you.

Hello.

My keyboard is "DFRobot LCD Keypad Shield". I've been looking online and my mistake was the wrong pin. Ahroa gunciona me very good LCD.

Thank you very much.

MAS3: You also need to read the warning (click !) on top of this section of the forum, it does apply to you.

I suggest you test the LCD shield using your digital multimeter (you do have one of course) on "diode test" with the red probe to Digital 10 on the shield and the black probe to GND.

If it reads between 0.5 and 1V proving the fault, it is suggested you de-solder the Digital pin 10 on the LCD using a solder sucker (or braid), wiggle it loose and pull it completely out of the plastic header (it will be loose if you have de-soldered it). You will not be able to turn the backlight off, but that really does not matter.

Hmm, glad I peeked at this thread, because I had missed the pin 10 thing. My DFR shield shows ~0.6V on pin 10 with the diode test so I guess I'll need to fix that.

For the record, @OP, I've been using LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

Hello:

I already work. I found a link coded menus here.

Thanks for the help.