using the seeeduino film sleep button in my code

i’m having trouble catching the sleep button interrupt.

this is my code,

[code]int pin = 8;
volatile int state = LOW;

void setup()
{
pinMode(pin, OUTPUT);
attachInterrupt(0, blink, CHANGE);
}

void loop()
{
digitalWrite(pin, state);
}

void blink()
{
state = !state;
}[/code]

i expect it to turn the onboard led on and off but it does not do this. please help. thanks!

When you push the button, it bounces making on/off multiple time. This generate many interrupts one after the other. So the ISR is called many time changing rapidly the state of your LED.
You should make some debounce inside your ISR to be sure the ISR is called only once per push.