Problem with setDebounceTime function

have you guys tried to use the setDebounceTime function? I get a an error:

Keypad01:30: error: expected constructor, destructor, or type conversion before ‘(’ token

Perhaps you are using it incorrectly. What does your code look like?

ok, looks like I found the problem

I forgot to add the name of the keypad (keypad4x4) in front of the setDebounceTime, i.e. like this: keypad4x4.setDebounceTime(50);

It works, but I don’t fully understand why it wont work without the name of the keypad. Is it because the setDebounceTime function is only available from within the Keypad constructor?

here is the excerpt from Keypad.cpp:

// <<constructor>> Allows custom keymap, pin configuration, and keypad sizes.
Keypad::Keypad(char *userKeymap, byte *row, byte *col, byte numRows, byte numCols) {
	rowPins = row;
	columnPins = col;
	sizeKpd.rows = numRows;
	sizeKpd.columns = numCols;


	keypadEventListener = 0;

	startTime = 0;

void Keypad::setDebounceTime(uint debounce) {
	debounce<1 ? debounceTime=1 : debounceTime=debounce;

and the sketch itself, without the VOID LOOP.

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char keys[ROWS][COLS] = {

byte colPins[ROWS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad
byte rowPins[COLS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad 
Keypad keypad4x4 = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); //constructor
byte ledPin = 13; 

boolean blink = false;

void setup(){
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
  digitalWrite(ledPin, HIGH);   // sets the LED on


Each keypad object has a separate debounce time so the compiler needs to know which keypad you are setting the debounce time for.

THe author of the Keypad library could have used static' object data and functions to have a single debounce time shared by all Keypad objects. In that case you would have had to say 'Kepad::setDebounceTime()' to let the compiler know you were calling a static function for the Keypad class of objects.