Description
The digitalPinToInterrupt()
function takes a pin as an argument, and returns the same pin if it can be used as an interrupt. For example, digitalPinToInterrupt(4)
on an Arduino UNO will not work, as interrupts are only supported on pins 2,3.
See attachInterrupt() for a full list of supported interrupt pins on all boards.
Syntax
digitalPinToInterrupt(pin)
Parameters
-
pin
- the pin we want to use for an interrupt.
Returns
-
The pin to interrupt (e.g.
2
)+ -
If pin is not available for interrupt, returns
-1
.