{"id":20778979,"url":"https://github.com/andersmmg/arduino-keypad-lock","last_synced_at":"2026-02-04T15:39:02.030Z","repository":{"id":129119422,"uuid":"52402897","full_name":"andersmmg/arduino-keypad-lock","owner":"andersmmg","description":"Arduino Keypad Lock with Password Changing","archived":false,"fork":false,"pushed_at":"2016-05-16T00:18:33.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T22:17:54.204Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andersmmg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-24T00:51:12.000Z","updated_at":"2016-02-24T00:51:12.000Z","dependencies_parsed_at":"2023-03-23T23:18:17.853Z","dependency_job_id":null,"html_url":"https://github.com/andersmmg/arduino-keypad-lock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andersmmg/arduino-keypad-lock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersmmg%2Farduino-keypad-lock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersmmg%2Farduino-keypad-lock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersmmg%2Farduino-keypad-lock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersmmg%2Farduino-keypad-lock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andersmmg","download_url":"https://codeload.github.com/andersmmg/arduino-keypad-lock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersmmg%2Farduino-keypad-lock/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259957155,"owners_count":22937538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T13:25:22.882Z","updated_at":"2026-02-04T15:38:56.999Z","avatar_url":"https://github.com/andersmmg.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# arduino-keypad-lock\nArduino Keypad Lock with Password Changing\n#include \u003cKeypad.h\u003e\n#include \u003cPassword.h\u003e\n \nString newPasswordString; //hold the new password\nchar newPassword[6]; //charater string of newPasswordString\n \n//initialize password to 1234\n//you can use password.set(newPassword) to overwrite it\nPassword password = Password( \"1234\" );\nPassword passwordset = Password( \"\" );\nboolean change = false;// Are we changing the code?\nbyte maxPasswordLength = 4; // Self-explanatory\nbyte currentPasswordLength = 0;//^ Same as above ^\nconst byte ROWS = 4; // Four rows\nconst byte COLS = 4; // Four columns\n \n//Define the keymap\nchar keys[ROWS][COLS] = {\n{'1','2','3','A'},\n{'4','5','6','B'},\n{'7','8','9','C'},\n{'*','0','#','D'}\n};// Set yours, they can often be different\n \n//// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.\nbyte rowPins[ROWS] = {6,7,8,9}; //connect to row pinouts\n \n// Connect keypad COL0, COL1, COL2 and COL3 to these Arduino pins.\nbyte colPins[COLS] = {2,3,4,5}; //connect to column pinouts\n \n// Create the Keypad\nKeypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );\n \nvoid setup(){\n   Serial.begin(9600);// Set up Serial\n}\n \nvoid loop(){\n  if(change=false){// If we aren't changing password\n   char key = keypad.getKey();// Get the key\n   if (key != NO_KEY){// If there is a key being pressed\n      delay(60); // Wait a bit\n      switch (key){// Evaluate the key pressed\n      case '#': checkPassword(); break;\n      case '*': change=true; break;\n      default: processNumberKey(key);\n      }\n   }\n  }\n  else {// Same as above, but is changing password instead of\n        // entering the code\n    char key = keypad.getKey();\n   if (key != NO_KEY){\n      delay(60); \n      switch (key){\n      case '#': /* nothing */ break;\n      case '*': changePassword(); change=false; break;\n      default: processChange(key);\n      }\n   }\n  }\n}\n \nvoid processChange(char key) {\n   Serial.print(key);\n   currentPasswordLength++;\n   passwordset.append(key);\n   if (currentPasswordLength == maxPasswordLength) {\n      password.set(passwordset);// Set the passcode\n   } \n}\n \nvoid processNumberKey(char key) {\n   Serial.print(key);\n   currentPasswordLength++;\n   password.append(key);\n   if (currentPasswordLength == maxPasswordLength) {\n      checkPassword();// Validate the entered code\n   } \n}\n\nvoid checkPassword() {// Validation\n   if (password.evaluate()){\n      Serial.println(\" OK.\");\n   } else {\n      Serial.println(\" Wrong password!\");\n   } \n   resetPassword();\n}\n\nvoid resetPassword() {// Reset password. Duh :)\n   password.reset(); \n   currentPasswordLength = 0; \n}\n\nvoid changePassword() {// Change the password\n   newPasswordString = \"123\";\n   newPasswordString.toCharArray(newPassword, newPasswordString.length()+1); //convert string to char array\npassword.set(newPassword);\n   resetPassword();\n   Serial.print(\"Password changed to \");\n   Serial.println(newPasswordString);\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersmmg%2Farduino-keypad-lock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandersmmg%2Farduino-keypad-lock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersmmg%2Farduino-keypad-lock/lists"}