knock lock (instead of knock --> button)

Is there any way to make arduino recognize a series of timed presses of a button to make it similar to the knock lock project but instead using a button?


Any hint of how to do that??

The same way it was done with the lock. The only change is to read the button instead of reading a piezo.

So instead of analogRead(piezo)
It goes------>digitalRead(buttonPin)

And setting threshold to 1?

Was it really that simple? I've been searching for a lot of time...

Doesn't that make sense?