Hi,
I have a problem compiling the keypad example code. I'm getting the following error messages:
Keypad_zelf.cpp.o: In function __static_initialization_and_destruction_0': Keypad_zelf.cpp:22: undefined reference to Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)'
Keypad_zelf.cpp.o: In function loop': Keypad_zelf.cpp:35: undefined reference to Keypad::getKey()'
This is the code I use:
#include "Keypad.h"
const byte ROWS = 4; // Four rows
const byte COLS = 4; // Three columns
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'#','0','*','D'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 5, 4, 3, 2 };
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 9, 8, 7, 6 };
// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
#define ledpin 13
void setup()
{
digitalWrite(ledpin, HIGH);
Serial.begin(9600);
}
void loop()
{
char key = kpd.getKey();
if(key) // same as if(key != NO_KEY)
{
switch (key)
{
case '*':
digitalWrite(ledpin, LOW);
break;
case '#':
digitalWrite(ledpin, HIGH);
break;
default:
Serial.println(key);
}
}
}
I hope some one can tell me what the problem is.