Hi
I have a Gertboard (new rev) plugged directly into a Raspberry Pi.
For this test, I've connected button 3 to pin 2 of the Atmega (B3 to PD2), plus serial and programming connections as per the manual. I've tested the wiring is OK - a sketch with a digitalRead(2) can detect a change when the button is pressed.
My test sketch is:-
const int interruptPin = 2;
volatile int btnpress = 0;
void setup() {
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(interruptPin, inter, CHANGE);
Serial.begin(9600);
Serial.println("Start");
}
void loop() {
if (btnpress!=0)
{
Serial.println("Interrupted!");
btnpress = 0;
}
delay(500);
}
void inter()
{
btnpress = 1;
}
Unfortunately, press the button and no interrupt.
"attachInterrupt" isn't mentioned directly in the Gertboard manual, and none of the pre-loaded examples seems to included it.
So, are Interrupts actually supported? If so, what am I missing here?