Bounce question

I am using the Bounce library to manage some buttons. http://www.arduino.cc/playground/Code/Bounce

Part of my design includes a reset button that I only want to activate if the user presses it for more than a second.

Do I just set the debounce interval to 1000 (ms) ?

Wouldn't you start watching duration() after the correct edge transition? Once it gets to 1000, set a flag.

Would this work, just define your 'reset' pin and use a 1000msec debounce time?

define BUTTON2 3 //reset button wired to pin 3

Bounce resetbutton = Bounce( BUTTON2,10000 );

retrolefty: Would this work, just define your 'reset' pin and use a 1000msec debounce time?

define BUTTON2 3 //reset button wired to pin 3

Bounce resetbutton = Bounce( BUTTON2,10000 );

That's what I was thinking. I just wanted to make sure I was thinking of it correctly. I'll post up after I get a chance to try it out.

That's what I was thinking. I just wanted to make sure I was thinking of it correctly. I'll post up after I get a chance to try it out.

Just don't use 10,000 like I wrote, use 1000. ;)

Lefty

So it doesn't quite work that way. The way to do it is to use the duration() method. There is example code included with the Bounce library and I've got it working. Here's the key parts...

Bounce orientation = Bounce( ORIENTATION_PIN, 50 );

int awake; // Are we awake based on our current orientation?

void setup() {
  awake = orientation.read();
 ...
}

void loop() {
  orientation.update();
  ...
  // has our orientation changed for more the 1/2 a second?
  if ( orientation.read() != awake && orientation.duration() > 500 ) {
  }
}