Problem with my library

Hi friends I want to write my library to push button with debounce.
I have wrote the first version very simple and it works, this is *.h:

#ifndef KeypadLCD_h
#define KeypadLCD_h

#include "Arduino.h"

   #define btnRIGHT  0
   #define btnUP     1
   #define btnDOWN   2
   #define btnLEFT   3
   #define btnSELECT 4
   #define btnNONE   5

class KeypadLCD{
	public:
		KeypadLCD(int pin);
		int ReadButtons();
	private:
		int _pin;
	};
	
#endif

This is *.cpp:

#include "Arduino.h"
#include "KeypadLCD.h"

int adc_key_in  = 0;

KeypadLCD::KeypadLCD(int pin){
pinMode(pin, INPUT);
_pin = pin;
}

int KeypadLCD::ReadButtons(){
  
   adc_key_in = analogRead(_pin); 
   if (adc_key_in > 1000) return btnNONE;
   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;
  }

So, I have to write the debounce function into my code.
I would to include this function in the library. I have change my library in this way, *.h:

#ifndef KeypadLCD_h
#define KeypadLCD_h

#include "Arduino.h"

   #define btnRIGHT  0
   #define btnUP     1
   #define btnDOWN   2
   #define btnLEFT   3
   #define btnSELECT 4
   #define btnNONE   5

class KeypadLCD{
	public:
		KeypadLCD(int pin);
		int ReadButtons();
	private:
		int _pin;
		int conv();
	};
	
#endif

And *.cpp:

#include "Arduino.h"
#include "KeypadLCD.h"

int adc_key_in  = btnNONE;
int stato = 0;
int pre_stato = 0;
unsigned int now = 0;

KeypadLCD::KeypadLCD(int pin){
  pinMode(pin, INPUT);
  _pin = pin;
}

int KeypadLCD::ReadButtons(){
  
   stato = analogRead(_pin); 
   
   //Antirimbalzo
  if(pre_stato == 0 && stato != 0){
    pre_stato = conv();
  }   
  
  //Questa condizione mi serve per by-passare l'antirimbalzo per i pulsanti di Up e Down
  if(pre_stato != 0 && (stato == 0 || (((stato > 50 && stato < 195) ||(stato > 195 && stato < 380)) && millis() > (now - 1000)))){    
   adc_key_in = conv();
   now = millis();
   pre_stato = 0;
  }
  //Fine antirimbalzo 
  }
  
int KeypadLCD::conv(){
	if (stato > 1000) return btnNONE;
   if (stato < 50)   return btnRIGHT;  
   if (stato < 195)  return btnUP; 
   if (stato < 380)  return btnDOWN; 
   if (stato < 555)  return btnLEFT; 
   if (stato < 790)  return btnSELECT;
}

But it doesn’t work. Why?
Thanks for your help.

But it doesn't work.

Rather poor description of the problem.

Uhm really I have test this program:

#include <KeypadLCD.h>

KeypadLCD key(0);
int lcd_key = 0;

void setup(){
  Serial.begin(9600);
  Serial.print("Buongiorno");
}

void loop(){

  lcd_key = key.ReadButtons();

  switch(lcd_key){
  case btnRIGHT:
    Serial.println("RIGHT ");
    break;

  case btnUP:
    Serial.println("UP ");
    break;

  case btnDOWN:
    Serial.println("DOWN ");
    break;

  case btnLEFT:
    Serial.println("LEFT ");
    break;

  case btnSELECT:
    Serial.println("SELECT ");
    break;

  case btnNONE:
    Serial.print("NONE ");
    break;
  }
  delay(300);
}

That write on Serial Monitor what button I have pressed. And it doesn’t write anything

Ah, I use the lcd shield

That is not a standard (comes with the IDE) library. To avoid confusion and guesswork, can you link to the actual library that you are using?

If you insert a

Serial.print(lcd_key);

after

lcd_key = key.ReadButtons();

what do you get in serial monitor?

The first two *.h and *.cpp are the library that I use and works well. When I press a button I read fow example "btnLEFT" if I have pressed the button LEFT.

The library:

#include <KeypadLCD.h>

is that I have wrote above.