Button Verify

Hello,

Is there a way to make it so you have to hold a button down for 2 seconds to make the arduino take action?

Thanks ;D

Yes.

Each pass through loop, see if a switch is pressed. If it is, but was not before, record the time.

Each pass through loop, see if the button is pressed, and was pressed before. If it is, see if it has been more than two seconds since the button was pressed. If it has, do something.

You know, I presume, how to check that a switch is pressed, and how to use millis() to observe the "time".

code please?

yuck! ::slight_smile:

code please?

OK. Here's a start:

// Put some stuff here

void setup()
{
   // May want to put some stuff here
}

void loop()
{
   // Put some stuff here
}

You should know how to read whether a switch is pressed (digitalRead). You should know how to save the previous state (=).
You should know how to determine how much time has elapsed (millis).
It's trivial putting the stuff together in the right order.

If that last assumption is false, make a stab at it, and post your code here for help.