No button held statement?

I wonder if there is any button held statement that I can use for my Arduino project? I got two buttons and one LED. I want the LED to start blink when I've held button1 for 5 seconds. And then when I've held button2 for 5 seconds I want it to turn off.

Have a look at the code in this link

...

5 seconds after I've tapped the button it starts to blink. But I want it to blink after I've held it down for 5 seconds. :confused:

Record the time the switch is pressed, set a flag.
If the switch is released within 5 seconds, reset the flag.
If 5 seconds goes by with the flag set, do your stuff.

.

#define LEDon        LOW
#define LEDoff       !LEDon
#define BUTTONpushed LOW

unsigned long lastMillis;
unsigned long heldMillis;
const byte switchButton  = 8;
const byte ledPin        = 13;
bool flag                = false;
byte currentState;
byte lastState;

//************************************************************************
void setup()
{
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LEDoff);

  pinMode(switchButton, INPUT_PULLUP);

} //END of                   s e t u p ( )

//************************************************************************
void loop()
{
  //****************
  if (flag == true && millis() - heldMillis > 5000ul)
  {
    //reset the flag
    flag = false;
    //LED on
    digitalWrite(ledPin, LEDon);
  }

  //****************
  if (millis() - lastMillis > 50)
  {
    //restart the timing
    lastMillis = millis();
    //go and check the switches
    checkSwitches();
  }

} //END of                       l o o p ( )

//************************************************************************
void checkSwitches()
{
  currentState = digitalRead(switchButton);

  if (lastState != currentState)
  {
    //update to the new state
    lastState = currentState;

    //is the switch now pushed
    if (currentState == BUTTONpushed)
    {
      //set the flag
      flag = true;
      //initialize the timer
      heldMillis = millis();
    }

    else
    {
      //reset the flag
      flag = false;
      //LED off
      digitalWrite(ledPin, LEDoff);
    }
  }

} //END of            c h e c k S w i t c h e s ( )

//************************************************************************

arduotto:
5 seconds after I've tapped the button it starts to blink. But I want it to blink after I've held it down for 5 seconds. :confused:

You need to post your program so I can see exactly what you are doing.

...R