time interval..

Hi.. I would like to know what library and what is the programming method could I use to this statement..

I am currently developing a project using secret knock with attempt warning after 3 times of wrong attempt.

int attempt = 0;

Increment when someone knock with wrong pattern.. when it reaches 3, the buzzer will be high..

What I would like to do is:

  1. When someone knock It will increment the attempt but when the knocker stop with 10 minutes interval the variable attempt should be back to zero.

You should start by reading and understanding the Blink Without Delay example. That will teach you how to use the millis() function to keep track of events over time.

Yah.. I figured that but I can't do this one thing above.. T_T

It's quite simple (if I understand your requirements right):

  1. Someone knocks. Set a variable (unsigned long) to equal millis().
  2. If millis() - the variable you set above > the time interval (10 minutes), then reset you counters etc.

If you only want it to be 10 minutes from the time of the first knock, not the last knock, then you only set your variable if it's 0, and when you time out, set it back to 0 so you can start again.

Thank you… I will go back in this tread to show you a result…

I'm kinda slow... T_T I don't get it after all. Does this will interrupt other process? Can you provide an entire code of it? please..

If you’re capable of writing code to recognise the secret knock, then keeping a count of failed attempts and resetting that count after an interval is relatively simple - it’s using techniques that you would need to have understood already in order to recognise the secret knock in the first place. So - have you figured out how to recognise the secret knock?