# Detach interrupts from a source in Arduino

ArduinoArduino BoardsArduino IDEArduino Programming Language

We have seen that in order to attach interrupts to a source, we use the .attachInterrupt() function, with the required arguments.

For example, for attaching the interrupts to a specific pin, we use

attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);

In the same way, to detach the interrupt from a source, we can call the detachInterrupt() function. This will simply disable that particular interrupt. The recommended syntax for disabling pin interrupts is −

detachInterrupt(digitalPinToInterrupt(pin))

where pin is the pin number on which you wish to disable the interrupt.

Published on 31-May-2021 14:29:34