I have a project which, to save on battery, is put to sleep until an interrupt pin is rising from LOW to HIGH.

This works well on Arduino Nano, however the translation doesn't on the ATTiny.

#include <avr/sleep.h>
void setup(){
void wakeUp(){
   //Something Something

Both on the Arduino Nano and the AtTiny, the interrupt Pin 0 is equivalent to Pin 2.

  • The Arduino is set to ISP
  • I have run the Bootloader (with internal clock as 8MHz if that makes a difference)
  • The program loads on the AtTiny45.

Yet, the interrupt pin does not interrupt.

Does the INT0 act differently on a ATTiny than on the Arduino, and if so, how can I wake up my AtTiny?

  • 2
    attachInterrupt(digitalPinToInterrupt(pin), ...
    – Juraj
    Commented Oct 18, 2020 at 7:20
  • 2
    The INT0 value is 0 for Atmega328 and it's 6 for the Attiny45... It was working just by accident on the other Arduino. It's not even supposed to be used with attachInterrupt (it's used by attachInterrupt to setup registers correctly)
    – KIIV
    Commented Oct 18, 2020 at 7:25
  • Aaaaah so that's why it's not recommended. I will give it a try and come back with corrections! Thank you both!
    – B7th
    Commented Oct 18, 2020 at 9:09
  • @Juraj, For some reason my version of Arduino IDE does not recognize the digitalPinToInterrupt? Looks like a usual thing so will see how else I can do this. Currently diving in the GIMSK etc. :S
    – B7th
    Commented Oct 19, 2020 at 7:15
  • 1
    it is possible that the Arduino core in this boards support package doesn't have the function
    – Juraj
    Commented Oct 19, 2020 at 8:19

1 Answer 1


After going through a lot of documentation, it seemed best and more efficient to attach the interrupt without functions.

EIMSK  |=  (1<< INT0);//Attaches the interrupt
MCUCR  |=  (1<< SM1)  //Power-down mode
         | (1<<ISC01) //The rising edge of INT0
         | (1<<ISC00);// generates an interrupt request
  • I think it's great that you came back and answered your own question. But, this answer seems weirdly mismatched with the question "Does the INT0 act differently on a ATTiny than on the Arduino, and if so, how can I wake up my AtTiny?"
    – timemage
    Commented Jan 13, 2021 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.