Skip to content
Go to file


Failed to load latest commit information.
Latest commit message
Commit time


---- README --------------------------------------------------------------------
	PinChangeInt README. Find instructions and more information at

This library is deprecated as of April 3, 2015. This means that I will be
providing bug fixes for some time, but users are encouraged to migrate to
the EnableInterrupt library, at .
It is faster and easier to use. Thank you.

---- DESCRIPTION ---------------------------------------------------------------
This is the PinChangeInt library for the Arduino. It provides an extension to
the interrupt support for ATmega328 and ATmega2560-based Arduinos, and some
ATmega32u4 and Sanguinos. It adds pin change interrupts, giving a way for users
to have interrupts drive off of any pin (ATmega328-based Arduinos), by the Port
B, J, and K pins on the Arduino Mega and its ilk, and on the appropriate ports
(including Port A) on the Sanguino and its ilk. Yun and Sanguino support are
weak, quite honestly, as I don't have either a Sanguino or a Yun. Theoretically
the library would work with a Leonardo but I have no reports regarding that
platform. The ATmega32u4 has port B (8 pins) pin change interrupts only.

For more information refer to avr-gcc header files, Arduino source and Atmega

This library was inspired by and derived from Chris J. Kiick's PCInt Arduino
Playground example here:

The following pins are usable PinChangeInt pins on the Mega (ATmega1280 and
ATmega2560-based Arduinos**):

Arduino              Arduino              Arduino
  Pin*  PORT PCINT     Pin   PORT PCINT     Pin   PORT PCINT
  A8     PK0  16       10     PB4   4       SS     PB0   0
  A9     PK1  17       11     PB5   5       SCK    PB1   1
 A10     PK2  18       12     PB6   6       MOSI   PB2   2
 A11     PK3  19       13     PB7   7**     MISO   PB3   3
 A12     PK4  20       14     PJ1  10
 A13     PK5  21       15     PJ0   9
 A14     PK6  22       
 A15     PK7  23
...indeed, the ATmega2560 chip supports many more Pin Change Interrupt pins but
they are unavailable on the Arduino, unless you want to solder teeny tiny wires.

* Note: Arduino Pin 0 is PE0 (PCINT8), which is RX0 and thus is not supported by
this library.  It is the same pin the Arduino uses to upload sketches, and they
are connected to the FT232RL USB-to-Serial chip (ATmega16U2 on the R3).
** On the MegaADK, according to
"USB Host: MAX3421E. The MAX3421E comunicate with Arduino with the SPI bus. So
it uses the following pins:
Digital: 7 (RST), 50 (MISO), 51 (MOSI), 52 (SCK). NB: Please do not use Digital
pin 7 as input or output because is used in the comunication (sic) with
MAX3421E "

---- LICENSE -------------------------------------------------------------------
Licensed under the Apache2.0 license. See the source files for the license
boilerplate, the LICENSE file for the full text, and the NOTICE file which the
Apache2.0 license requires that you distribute with any code that you distribute
that uses this library. The copyright holders for this code are Chris J. Kiick,
Lex Talionis, and Michael Schwager. Chris and Lex have graciously agreed to the
Apache 2.0 license for this code, and beginning with version 2.40-rc1 this is
the license that applies.

---- ACKNOWLEDGMENTS -----------------------------------------------------------
This library was originally written by Chris J. Kiick, Robot builder and all
around geek, who said of it,
	"Hi, Yeah, I wrote the original PCint library. It was a bit of a hack
	and the new one has better features.  I intended the code to be freely
	usable.  Didn't really think about a license.  Feel free to use it in
	your code: I hereby grant you permission."
Thanks, Chris! A hack? I dare say not, if I have taken this any further it's
merely by standing on the shoulders of giants. This library was the best
"tutorial" I found on Arduino Pin Change Interrupts and because of that I
decided to continue to maintain and (hopefully) improve it. We, the Arduino
community of robot builders and geeks, owe you a great debt of gratitude for
your hack- a hack in the finest sense.

The library was then picked up by Lex Talionis, who created the Google Code
website. We all owe a debt of thanks to Lex, too, for all his hard work! He is
currently the other official maintainer of this code.

Many thanks to all the contributors who have contributed bug fixes, code, and
suggestions to this project: 

John Boiles and Baziki (who added fixes to PcInt), Maurice Beelen, nms277,
Akesson Karlpetter, and Orly Andico for various fixes to this code, Rob Tillaart
for some excellent code reviews and nice optimizations, Andre' Franken for a
good bug report that kept me thinking, cserveny.tamas a special shout out for
providing the MEGA code to PinChangeInt, and Pat O'Brien for testing and
reporting on the Arduino Yun.- Thanks!

A HUGE thanks to JRHelbert for fixing the PJ0 and PJ1 interrupt PCMSK1 issue on
the Mega... 06/2014

A HUGE thanks to Jan Baeyens ("jantje"), who has graciously DONATED an Arduino
Mega ADK to the PinChangeInt project!!! Wow, thanks Jan! This makes the
2560-based Arduino Mega a first class supported platform- I will be able to test
it and verify that it works.

Finally, a shout out to Leonard Bernstein. I was inspired by him
from a Ted talk by Itay Talgam. None of the contributors, myself included, has
any interest in making money from this library and so I decided to free up the
code as much as possible for any purpose.  ...But! You must give credit where
credit is due (it's not only a nice idea, it's the law- as in, the license

"If you love something,  give it away."

If apologize if I have forgotten anyone here. Please let me know if so.


Pin Change Interrupt library for the Arduino



You can’t perform that action at this time.