Hi,
I'm working on a project which will run on a attiny84. I'm testing it with an Arduino Uno.
I want to tell the chip to go to sleep mode (SLEEP_MODE_PWR_DOWN), then to wake up on an external interrupt (INT0).
It works like a charm on arduino uno... but not at all on attiny84. The chip just does not go to sleep and the interrupt is not caught.
do i need to add some libraries to make it work on attiny ?
do i use the right syntax for attachInterrupt ? (i tried attachInterrupt(INT0,wakeUpNow, LOW); : it just freeze the chip.)
Here is the code :
#include <avr/sleep.h>
void sleepNow()
{
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
attachInterrupt(0,wakeUpNow, LOW); // interrupt : INT0 (pin 0)
sleep_mode(); // go to sleep...
sleep_disable(); // wake up !
detachInterrupt(0);
}
thanks for your help !
Fab