attachInterrupt behaves wrongly on the MEGA

The pins you specify in the function call do not correspond to the actual pins that will be activated. For example, if you try to attach an interrupt to pin 2, attachInterrupt will enable the INT0 interupt, which is the Arduino pin 21.

Oh wait, maybe I actually mistook interrupt numbers for pin numbers, and attachInterrupt is not meant to accept the latter.

Oh wait, maybe I actually mistook interrupt numbers for pin numbers, and attachInterrupt is not meant to accept the latter.

I think you're on to something :slight_smile:

See http://arduino.cc/en/Main/ArduinoBoardMega for the mapping of pins to interrupt numbers.

Any chance for an update to the function ref docs to include info for the mega?

Done.