Here is my sample code (waked up by pin change interrupt)
//do nothing in interrupt func.
ISR(PCINT0_vect){
cli();
}
//main code:
//setup interrupt
GIMSK |= 1<< PCIE;
PCMSK |= 1<< PCINT0;
on_bulb(); //turn on light bulb
while(1) {
b1_low; //turn off
sei(); //enable interrupt
set_sleep_mode(SLEEP_MODE_PWR_DOWN); //set sleep mode
sleep_mode(); //sleep now
//wake up point here //
while (PINB & 0x1) { //if PINB is high
on_bulb();
}
}
I only measured once I finished the demo circuit, and it should use around 10 times less power when AVR is in sleep mode. Have fun.