Here's the code:
#include <Keypad.h>
#include <Password.h>
#include <BombDisplay.h>
BombDisplay bdisplay;
Password password = Password( "2158" );
const byte ROWS = 4; // Four rows
const byte COLS = 3; // columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
// 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] = { 8, 7, 6 };
// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
unsigned long mycounter = 0;
long n = 1000;
int count=5;
int latch = 0;
void setup()
{
keypad.addEventListener(keypadEvent);
}
void loop()
{
if(digitalRead(7) == HIGH)
{
keypad.getKey();
if(millis()-mycounter > n){
mycounter = millis();
if(count == 0){
bdisplay.clearDisplay();
bdisplay.displayOne(0);
} else {
bdisplay.clearDisplay();
bdisplay.displayOne(count);
count--;
}
}
}
}
void keypadEvent(KeypadEvent eKey){
switch (keypad.getState()){
case PRESSED:
switch (eKey){
case '*': checkPassword(); break;
case '#': password.reset(); break;
default: password.append(eKey);
}
}
}
void checkPassword(){
if (password.evaluate()){
setup();
return;
}else{
}
}
and here's the error:
In file included from BOMB_WITHOUT_KEYPAD.cpp:1:
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:50: error: 'byte' does not name a type
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:51: error: 'byte' does not name a type
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:63: error: 'byte' has not been declared
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:63: error: 'byte' has not been declared
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:63: error: 'byte' has not been declared
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:63: error: 'byte' has not been declared
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:78: error: ISO C++ forbids declaration of 'byte' with no type
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:78: error: expected ';' before '' token
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:79: error: ISO C++ forbids declaration of 'byte' with no type
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:79: error: expected ';' before '' token
In file included from BOMB_WITHOUT_KEYPAD.cpp:2:
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Password/Password.h:61: error: 'byte' does not name a type
BOMB_WITHOUT_KEYPAD:22: error: no matching function for call to 'Keypad::Keypad(char*, byte [4], byte [3], const byte&, const byte&)'
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:63: note: candidates are: Keypad::Keypad(char*, int*, int*, int, int)
C:\Users\Lucia\Desktop\arduino-1.0.1\libraries\Keypad/Keypad.h:57: note: Keypad::Keypad(const Keypad&)
It looks like there is something wrong with the keypad library.