Arduino Interrupt pins problem

Two things occur to me regarding the programs in Reply #18

in your first program this line is bad practice

        isrCount=0;                                       //####

Because isrCount is a 4-byte variable there is a risk that one of the bytes will be changed by the ISR while you are trying to set it to 0. You should update it with interrupts supended - like this

    noInterrupts();
       isrCount = 0;
    interrupts();

However, IMHO, there is nothing to be gained by setting the number back to 0.

And in the second program I would not have this line

          if(millis() - lastMillis>=1000){

inside the section of code where interrupts are disabled. You should ensure the interrupts are disabled for the shortest possible time.

Without trying your program (which I don't have time to do) I can't understand why it makes a difference which interrupt pin is used, although I assume the two pins have different priorities if you study the Atmega 328 datasheet closely. (It's a good read at bedtime :slight_smile: )

...R