Password Lock Door12
Password Lock Door12
// Pin direction
char array2[10]={'0','1','2','3','4','5','6','7','8','9'};
char no[16];
int no1[16];
char n=0;
int i;
char x;
char get_number(){
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1, "password?");
for(i=0;i<16;i++){no[i]=0;
for(i=0;i<16;i++){
while(no[i]==0){
no[i]=Keypad_Key_Click();
if(no[i]==5) {no[i]='4';no1[i]=4;}
if(no[i]==6) {no[i]='5';no1[i]=5;}
if(no[i]==7) {no[i]='6';no1[i]=6; }
if(no[i]==9) {no[i]='1';no1[i]=1; }
if(no[i]==10) {no[i]='2';no1[i]=2; }
if(no[i]==11) {no[i]='3';no1[i]=3; }
if(no[i]==14) {no[i]='0';no1[i]=0; }
if(no[i]==16) {no[i]='.';no1[i]=0; }
if(no[i]==1234) {no[i]="correct" ; }
if(no[i]==15){
return 0;}
Lcd_chr(2,i+1,no[i]);
void main() {
Keypad_Init();
Lcd_Init();
while(1){
get_number();
PORTA = 0x02;
PWM1_Init(5000);
PWM1_Start();
PWM1_Set_Duty(255);
delay_ms(500);
PWM1_Stop();
}
}