need button 6 seconds then off code help

Hi, can anyone help!
I need to make a LED come on when I push a button and off again when pushed again with debounce now that's all done in this sketch

#include <Bounce.h>
#define BUTTON 2
#define LED 13

int ledValue = LOW;

// This example changes the state of the LED everytime the button is pushed
// Build the circuit indicated here: http://arduino.cc/en/Tutorial/Button


Bounce bouncer = Bounce( BUTTON, 2 ); 

void setup() {
  pinMode(BUTTON,INPUT);
  pinMode(LED,OUTPUT);
}

void loop() {

   if ( bouncer.update() ) {
     if ( bouncer.read() == HIGH) {
       if ( ledValue == LOW ) {
         ledValue = HIGH;
       } else {
         ledValue = LOW;
       }
       digitalWrite(LED,ledValue);
     }
   }
}

That all works well but I need the LED to turn off when I hold the button down for about 6 seconds. Any help please.

Imagine that you are the Arduino, how would you do it? What are the steps you make. Something like :

  • wait for a keypress ON
  • if a keypress is ON check if it stays ON for 6 seconds => use millis()
  • if it is shorter that 6 seconds do nothing
  • else put the LED OFF

This is a must read for apps like this - http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay

If questions remain please post,