attachInterrupt() [External Interrupts]

Hello,
With regards to the program on this page I feel that it does not work correctly.
There seems to be a missing line to it.

Should the line below be included in the sketch or program?

define digitalPinToInterrupt

So that this line makes more sense?

attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);

Thanks Dafydd Claud.

I'll assume you're referring to the example code on this page:
https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/

dafyddclaud:
Should the line below be included in the sketch or program?

define digitalPinToInterrupt

No. digitalPinToInterrupt is a macro defined in the hardware package of the board you are compiling for. For example, here it is in the Arduino AVR Boards standard variant, which is used for the Uno, Nano, Pro Mini and similar Arduino boards:

#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))

So your proposed macro surely would change the behavior of the program for the worse!

I recommend you do this:
File > Preferences > Compiler warnings > All > OK

With warnings turned on you would get a very useful message in the black console window at the bottom of the Arduino IDE window when you compiled your proposed modified sketch:

C:\Users\accou\AppData\Local\Temp\arduino_modified_sketch_461587\sketch_jan17a.ino:1:0: warning: "digitalPinToInterrupt" redefined

 # define digitalPinToInterrupt

 ^

In file included from C:\Users\accou\Desktop\arduino-1.8.5\hardware\arduino\avr\cores\arduino/Arduino.h:257:0,

                 from C:\Users\accou\AppData\Local\Temp\arduino_build_283446\sketch\sketch_jan17a.ino.cpp:1:

C:\Users\accou\Desktop\arduino-1.8.5\hardware\arduino\avr\variants\standard/pins_arduino.h:79:0: note: this is the location of the previous definition

 #define digitalPinToInterrupt(p)  ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))

 ^