I'm using an Arduino R3 and sample sketch (link below) to try using pin change interrupts for the first time. I ran into an error (" 'attachPinChangeInterrupt' was not declared in this scope") when compiling the program for the first time; I have since added in the header file (PinChangeInt.h) also linked below. But the same problem occurs. Perhaps I have placed the header file in the wrong directory? It is in the same folder as my sketch (e.g. *.ino) file.
Any help greatly appreciated!!!!
// PinChangeInt SimpleExample sketch
// See the Wiki at http://code.google.com/p/arduino-pinchangeint/wiki for more information.
// for vim editing: :set et ts=2 sts=2 sw=2 et
// This example demonstrates the use of the PinChangeInt library on a single pin of your choice.
// This only works for ATMega328-compatibles; ie, Leonardo is not covered here.
// To use:
// 1. You must be using a fairly recent version of the Arduino IDE software on your PC/Mac,
// that is, version 1.0.1 or later. Check Help->About Arduino in the IDE.
// 2. Wire a simple switch to any Analog or Digital pin (known as ARDUINOPIN, defined below).
// Attach the other end to a GND pin. A "single pole single throw momentary contact"
// pushbutton switch is best for the best interrupting fun.
// 3. When pressed, the switch will connect the pin to ground ("low", or "0") voltage, and interrupt the
// processor. Don't let it confuse you that a switch press means the pin's voltage goes to 0; it
// may seem more intuitive to apply a "1" or high voltage to the pin to represent "pressed".
// But the processor is perfectly happy that we've made "0" equal "Pressed". The reason we've done so
This file has been truncated. show original
// This file is part of the PinChangeInt library for the Arduino. This library will work on any ATmega328-based
// or ATmega2560-based Arduino, as well as the Sanguino or Mioduino.
// Most of the pins of an Arduino Uno use Pin Change Interrupts, and because of the way the ATmega interrupt
// system is designed it is difficult to trigger an Interrupt Service Request off of any single pin, and on
// any change of state (either rising, or falling, or both). The goal of this library is to make it easy for
// the programmer to attach an ISR so it will trigger on any change of state on any Pin Change Interrupt pin.
// (NOTE TO SELF: Update the PCINT_VERSION define, below) -----------------
#define PCINT_VERSION 2402
/*
Copyright 2008 Chris J. Kiick
Copyright 2009-2011 Lex Talionis
Copyright 2010-2014 Michael Schwager (aka, "GreyGnome")
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
This file has been truncated. show original
Perhaps I have placed the header file in the wrong directory? It is in the same folder as my sketch (e.g. *.ino) file.
Either put the .h file in a folder named PinChangeInt in the libraries folder of your sketches directory or change
#include <PinChangeInt.h>
#include "PinChangeInt.h"