Manual
www.nexusrobot.com Robot Kits manual 
  31
¾ Pin Change Interrupt 
¾  PinChangeInt Library 
This library was inspired by and derived from the PcInt example by "johnboiles", and written by a 
"jbrisbin" (it seems).
While the PCInt example shows with generality how Pin Change interrupts can be done under Arduino, it 
is an 'example' effort that sacrifices performance for clarity of implementation. 
The PinChangeInt effort runs in the other direction, with clarity sacrificed for the highest performance. To 
that end, this implementation can handle a 4.5KHz input signal (with a 1 KHz timer running as well) on an 
8 MHzATMega328, with significant code in both the timer and pin change interrupt handlers. 
Usage 
The PinChangeInt library exposes two functions to to the user and provides macros that make it drop-in 
compatible with the PcInt code. 
To attach an interrupt use 
PCintPort::attachInterrupt(pin, userFunc, mode) 
or 
PCattachInterrupt(pin,userFunc,mode) 
To detach an interrupt use 
PCintPort::detachInterrupt(pin) 
or 
PCdetachInterrupt(pin) 
 See: http://arduino.cc/playground/Main/PinChangeInt 
¾  The Code 
PinChangeIntConfig.h 
 See: http://arduino.cc/playground/Main/PinChangeInt
PinChangeInt.h 
See : http://arduino.cc/playground/Main/PinChangeInt
PinChangeInt Example 
This code counts the number of times pin 15 (aka Analog 1) changes state and prints the count when it 
recives a p on the serial port. 
1.  /* 
2.  Copyright 2011 Lex.V.Talionis at gmail 
3.  This program is free software: you can redistribute it and/or modify it under the terms of the GNU 
General Public License as published by the Free Software Foundation, either version 3 of the 
License, or (at your option) any later version. 
4.  */ 
5. #include <PinChangeInt.h> 
6. #include <PinChangeIntConfig.h> 










