arduino door locking system

by:DIgao     2020-06-25
I made a door lock in this project (or box lock)
It opens when you enter your password and press. 1. Arduino uno2.
Standard servo.
Red and green LED 4.
Male and female pin heads 5. Door Lock6. 4X4 Keypad7.
As shown in the above figure, all connections are soldered by nessoldder.
Or use the belowUsing double tape stick servo connected with frtizing file, make a system using a thick metal wire, it can open the lock when the servo moves the picture above me, this will.
As shown in the above figure, arrange everything in order :-:-
Include/Tell to use the password library include/Tell to use the keyboard Library include/Tell to use the servo Library servo myservo;
/Declare servo password = password (\"0000\" );
/The password is unlocked, and the byte line can be changed = 4;
/Four lines of const byte COLS = 4;
/Column/definition key mapping character key [ROWS][COLS]= {{\'1\',\'2\',\'3\'}, {\'4\',\'5\',\'6\'}, {\'7\',\'8\',\'9\'}, {\'*\',\'0\',\'\'}};
/Connect the keyboard ROW0, ROW1, ROW2, and ROW3 to these Arduino pins. byte rowPins[ROWS]= {9, 8, 7, 6 };
/Connect the keyboard COL0, COL1, and COL2 to these Arduino pins. byte colPins[COLS]= {5, 4, 3 };
/Create Keyboard = keyboard (makeKeymap(keys)
, Line); void setup(){Serial. begin(9600); Serial. write(254); Serial. write(0x01); delay(200); pinMode(11, OUTPUT);
/Green pinMode (12, OUTPUT);
/Red myservo. attach(13);
Servo/servo keyboard on digital pin 9.
AddEventListener (keypadEvent);
/Add event listener for this keyboard}void loop(){keypad. getKey(); myservo. write(180); }
/Handling some special events
KeypadEvent eKey){switch (keypad. getState()){
By Box: serial. print(\"Enter:\"); Serial. println(eKey); delay(10); Serial. write(254); switch (eKey){
Case \'*\': check password (); delay(1); break;
Case: password. reset(); delay(1); break;
Default: password. append(eKey); delay(1); }}}
Invalid verification password (){if (password. evaluate()){
/If the password is the correct open serial number. println(\"Accepted\"); Serial. write(254); delay(10);
/If you run myservo, add the code you want to run. write(0);
/Digital Writing (11, HIGH);
/Open delay (10000);
/Wait 5 seconds for digital writing (11, LOW);
/Off}else {Serial. println(\"Denied\");
Please continue to lock the serial number if the password is wrong. write(254); delay(10);
/Add code to run if the code is not working. write(180);
digitalWrite(12, HIGH);
/Open delay (5000. );
/Wait 5 seconds for digital writing (12, LOW);
Power the Arduino and test everything. . .
The default password is 0000, as shown in the above figure, change the highlighted number. . .
And upload the code. . . . . Frtizing File :-
Custom message
Chat Online 编辑模式下无法使用
Chat Online inputting...