#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12 );
bool decrocher = false;
byte Decrocher = 6;
#include <Keypad.h>
const byte TX = 0;
const byte RX = 1;
bool effacer = false;
byte boutonEffacer = 5;
byte i=0;//indice du tableau d'enregitrement de saisie des touches clavier
byte a=5;//indice de l'affichage du code saisie
unsigned long temps_precedent=0;
const long interval=1000;
unsigned long temps;
char motdepasse1[]={'4','8','6','2'};
char motdepassetaper[]={'0','0','0','0'};
char motdepasse [] ={'7','9','6','1'};
byte ledok = 13;
const byte ROWS = 4; //4 lignes
const byte COLS = 3; //3 colonnes
//definition des caracters clavier
char hexaKeys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'},
};
byte rowPins[ROWS] = { A5,A4,A3,A2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {2,3,4}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
char customKey ;
//////////////////////////////////////////////////////////////////////////////////////
////////////////////////animation crane///////////////////////////////////////
/////////////////////////bouche fermee//////////////////////////////////////
byte haut_gauche[8] = {
0b00111,
0b01000,
0b10000,
0b10111,
0b10111,
0b10111,
0b10000,
0b01001,
};
byte haut_droit[8] = {
0b11100,
0b00010,
0b00001,
0b11101,
0b11101,
0b11101,
0b00001,
0b10010,
};
byte bas_gauche[8] = {
0b00100,
0b00100,
0b00111,
0b00101,
0b00010,
0b00001,
0b00000,
0b00000,
};
byte bas_droit[8] = {
0b00100,
0b00100,
0b11100,
0b10100,
0b01000,
0b10000,
0b00000,
0b00000,
};
////////////////////////////bouche ouverte//////////////////////////////////////
byte haut_gauche1[8] = {
0b00111,
0b01000,
0b10000,
0b10100,
0b10110,
0b10111,
0b10000,
0b01001,
};
byte haut_droit1[8] = {
0b11100,
0b00010,
0b00001,
0b00101,
0b01101,
0b11101,
0b00001,
0b10010,
};
byte bas_gauche1[8] = {
0b00100,
0b00100,
0b00111,
0b00101,
0b00101,
0b00100,
0b00101,
0b00111,
};
byte bas_droit1[8] = {
0b00100,
0b00100,
0b11100,
0b10100,
0b10100,
0b00100,
0b10100,
0b11100,
};
////////////////////////////////////////////////////////////
//////////////////////ANIMATION CADENAS//////////////////////////////////////
////////////////////////////CADENAS FERME////////////////////////////////
byte cadenas_haut_gauche[8] = {
0b00000,
0b00000,
0b00001,
0b00010,
0b00100,
0b00100,
0b00100,
0b00100,
};
byte cadenas_haut_droit[8] = {
0b00000,
0b00000,
0b10000,
0b01000,
0b00100,
0b00100,
0b00100,
0b00100,
};
byte cadenas_bas_gauche[8] = {
0b01111,
0b01000,
0b01001,
0b01001,
0b01011,
0b01000,
0b01111,
0b00000,
};
byte cadenas_bas_droit[8] = {
0b11110,
0b00010,
0b10010,
0b10010,
0b11010,
0b00010,
0b11110,
0b00000,
};
////////////////////////////////////////////////////////////////////:
/////////////////////////////CADENAS OUVERT///////////////////////////////////////////
////////////////////////////////////////////////////////////////////
byte cadenas_ouvert_haut_gauche[8] = {
0b00001,
0b00010,
0b00100,
0b00100,
0b00100,
0b00100,
0b00000,
0b00000,
};
byte cadenas_ouvert_haut_droit[8] = {
0b10000,
0b01000,
0b00100,
0b00100,
0b00100,
0b00100,
0b00100,
0b00100,
};
byte cadenas_ouvert_bas_gauche[8] = {
0b01111,
0b01000,
0b01001,
0b01001,
0b01011,
0b01000,
0b01111,
0b00000,
};
byte cadenas_ouvert_bas_droit[8] = {
0b11110,
0b00010,
0b10010,
0b10010,
0b11010,
0b00010,
0b11110,
0b00000,
};
//////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
void bouche_fermee(){
lcd.setCursor(0,0);
lcd.write(byte(0));
lcd.setCursor(1,0);
lcd.write(byte(1));
lcd.setCursor(0,1);
lcd.write(byte(2));
lcd.setCursor(1,1);
lcd.write(byte(3));
}
void bouche_ouverte(){
lcd.setCursor(0,0);
lcd.write(byte(4));
lcd.setCursor(1,0);
lcd.write(byte(5));
lcd.setCursor(0,1);
lcd.write(byte(6));
lcd.setCursor(1,1);
lcd.write(byte(7));
}
//////////////////////////////////////////////////////////////////
void bouche_fermee1(){
lcd.setCursor(2,0);
lcd.write(byte(0));
lcd.setCursor(3,0);
lcd.write(byte(1));
lcd.setCursor(2,1);
lcd.write(byte(2));
lcd.setCursor(3,1);
lcd.write(byte(3));
}
void bouche_ouverte1(){
lcd.setCursor(2,0);
lcd.write(byte(4));
lcd.setCursor(3,0);
lcd.write(byte(5));
lcd.setCursor(2,1);
lcd.write(byte(6));
lcd.setCursor(3,1);
lcd.write(byte(7));
}
///////////////////////////////////////////////////////////////////
void bouche_fermee3(){
lcd.setCursor(14,0);
lcd.write(byte(0));
lcd.setCursor(15,0);
lcd.write(byte(1));
lcd.setCursor(14,1);
lcd.write(byte(2));
lcd.setCursor(15,1);
lcd.write(byte(3));
}
void bouche_ouverte3(){
lcd.setCursor(14,0);
lcd.write(byte(4));
lcd.setCursor(15,0);
lcd.write(byte(5));
lcd.setCursor(14,1);
lcd.write(byte(6));
lcd.setCursor(15,1);
lcd.write(byte(7));
}
///////////////////////////////////////////////////////////////:
void bouche_fermee2(){
lcd.setCursor(12,0);
lcd.write(byte(0));
lcd.setCursor(13,0);
lcd.write(byte(1));
lcd.setCursor(12,1);
lcd.write(byte(2));
lcd.setCursor(13,1);
lcd.write(byte(3));
}
void bouche_ouverte2(){
lcd.setCursor(12,0);
lcd.write(byte(4));
lcd.setCursor(13,0);
lcd.write(byte(5));
lcd.setCursor(12,1);
lcd.write(byte(6));
lcd.setCursor(13,1);
lcd.write(byte(7));
}
///////////////////////////////////////////////////////////////////:
////////////////////////////////////////////////////////////////////
void cadenas_ouvert(){
lcd.setCursor(4,0);
lcd.write(byte(010));
lcd.setCursor(5,0);
lcd.write(byte(011));
lcd.setCursor(4,1);
lcd.write(byte(012));
lcd.setCursor(5,1);
lcd.write(byte(013));
}
void cadenas_ferme(){
lcd.setCursor(4,0);
lcd.write(byte(014));
lcd.setCursor(5,0);
lcd.write(byte(015));
lcd.setCursor(4,1);
lcd.write(byte(016));
lcd.setCursor(5,1);
lcd.write(byte(017));
}