I am trying to learn how to use external interrupts on an Arduino Uno. the Arduino Reference page for attachInterrupt() lists the following example code:
const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}
void loop() {
digitalWrite(ledPin, state);
}
void blink() {
state = !state;
}
I copied this code into a blank sketch I called test_interrupt, and got the following error message when I checked the sketch:
Arduino: 1.0.6 (Windows XP), Board: "Arduino Uno"
C:\Program Files\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -IC:\Program Files\Arduino\hardware\arduino\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\variants\standard C:\DOCUME~1\User\LOCALS~1\Temp\build4157219780155555346.tmp\test_interrupt.cpp -o C:\DOCUME~1\User\LOCALS~1\Temp\build4157219780155555346.tmp\test_interrupt.cpp.o
test_interrupt.ino: In function 'void setup()':
test_interrupt:8: error: 'NOT_AN_INTERRUPT' was not declared in this scope
Any help would be greatly appreciated...