hi , i am trying to use sleep mode and wake up by interrupt. i am little confused by interrupt pin exactly which interrupt pin i have use for wake up . also request you small example code sleep and wake up on atmega32.
`const int ledpin=0;
const int sleepkey=20;
const int wakeupkey=2;
hi , i am trying to use sleep mode and wake up by interrupt. i am little confused by interrupt pin exactly which interrupt pin i have use for wake up . also request you small example code sleep and wake up on atmega32.
`const int ledpin=0; const int sleepkey=20; const int wakeupkey=2;
volatile bool once = true; volatile int i =0;
void setup() {
pinMode(wakeupkey,INPUT_PULLUP);
Serial.begin(9600); pinMode(ledpin,OUTPUT); pinMode(sleepkey,INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(wakeupkey), wake, FALLING);
}
void loop() {
digitalWrite(ledpin,HIGH);
if((digitalRead(sleepkey)==LOW) && once == true){
}
}
void wake() {
Serial.println("Wakeup"); i++; Serial.println(i);
once = true; //noSleep(); }`