Update to attachinterrupt documentation

Hi, I am using Arduino Mega and after checking the source code, I noticed the documentation for attachinterrupt is not correct.

Instead of:
The Arduino Mega has an additional four: numbers 2 (pin 21), 3 (pin 20), 4 (pin 19), and 5 (pin 18).

I suggest the following update:
The Arduino Mega supports 8 external interrupts: number 0 (PWM3), 1 (PWM4), 2 (Digital Pin 53), 3 (Digital Pin 52), 4 (Digital Pin 51), 5 (Digital Pin 50), 6 (PWM5) and 7 (PWM6). Note that the pins for interrupt 2,3,4 and 5 are used for ICSP programming as well.

Rgds

Just to add to the earlier suggested update.

PWM3 to 6 are also effectively digital pins 3 to 6.

Example,

// use interrupt 7 (PWM6) -- only for Arduino Mega

pinMode(6, INPUT);
digitalWrite(6, HIGH); //enable pull up resistor
attachInterrupt(6, your_routine, LOW); //interrupt when PWM6 is low

Hope this helps to clarify the documentation. :slight_smile:

Please disregard my earlier postings! I made a MISTAKE! The original documentation is in fact correct.

I mistook PCINT for INT.

So interrupt
0 -- PWM2 or digital pin 2
1 -- PWM3 or digital pin 3
2 -- SCL or 21
3 -- SDA or 20
4 -- RXD1 or 19
5 -- TXD1 or 18
6 -- not routed out
7 -- not routed out

Much ado about nothing .... Sorry :stuck_out_tongue:

No need to apologize. Bugs and Suggestions are supposed to be posted here first so they can be discussed and debated. There was some discussion. There was some debate. And the conclusion was that the documentation is fine. The process worked.

You being the only one in the discussion may make you a bit eccentric but, around here, that's a good thing! :wink:

You being the only one in the discussion may make you a bit eccentric but, around here, that's a good thing!

Keep it up, and you'll become a valuable addition to the Arduino Psychic Network. We need more members.

PCINT are interrupt generators too, but only work when there is a change from 0 to 1 or 1 to 0, and need a bit more code to put then working, but they are interrupts.