17391939:
BTW I have read all the documentation on interrupts widely.
The you should have read how the interrupt trigger type (rising, falling, etc) and other characteristics can be changed through direct manipulation of the registers defined in Chapter 13 of the ATmega328P datasheet. Calling attachInterrupt() inside the ISR is uncalled for.
Robin2:
I believe what I suggested in Reply #16 provides a solution within the scope of the OP's current programming knowledge.
...R
Perhaps. I haven't dug deeply into OP's code. But I do see that the various repeated calls to attachInterrupt() change the mode between RISING and FALLING. If that's really necessary, the appropriate way is with the EICRA register before returning from the ISR. You could also use the CHANGE mode, but then a read (preferably directly via the PINx register) would be needed to know the cause of the interrupt (falling / rising). Regardless, calling attachInterrupt() is NOT the way to do it.