Knock Door Lock Help !!! now woth the code

hi I have a code that I downloaded from a YouTube video, and I have being doing some improvements. This program detects every time you knock the door, and if the knocks follows a specific rhythm (code) it opens the door. but if the rhythm is wrong, you can try again as many times as you want, so I want to limit the times you can try the knock rhythm and then delay for about 1 to 5 minutes as a security measure. The problem is that I can’t do that part of the code, so if someone can help me it will really help me a lot.

Knock_dor_lock.ino (10.4 KB)

Post your code in code tags - many more people will look at it that way - ensure it well layed out (Auto format - tools on the IDE menu - before you post. Help us to help you

What are the symptoms of the "crash"?

Mark