Hi everybody,
I bought a 2x2 matrix keyboard which I want to connect to my Arduino Uno. I downloaded the keypad library ( Arduino Playground - HomePage) and copied it to the libraries folder. It is displayed in the libraries list in the Arduino IDE, but it does not work. I tested the example code as you see beloy and got the following error message. I am using IDE 1.0.1 on a Mac.
What is wrong? Please help me. Thank you very much.
Cheers,
Duesentrieb
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
Serial.begin(9600);
}
void loop(){
char key = keypad.getKey();
if (key != NO_KEY){
Serial.println(key);
}
}
Error message:
sketch_aug29a_keypad_library_test:13: error: 'Keypad' does not name a type
sketch_aug29a_keypad_library_test.cpp: In function 'void loop()':
sketch_aug29a_keypad_library_test:20: error: 'keypad' was not declared in this scope
sketch_aug29a_keypad_library_test:22: error: 'NO_KEY' was not declared in this scope