I've made simple circuit to master Arduino interrupts. I wrote also a simple program keeping track of how many times button has been pressed. For unknown reasons Arduino seems to call INT0 interrupt even on change on digital pin 3. What am I doing wrong?
Here's code, and circuit:
volatile int count0 = 0;
void setup()
{
Serial.begin(9600);
// Set input and pullups
pinMode(2, INPUT);
digitalWrite(2, HIGH);
pinMode(3, INPUT);
digitalWrite(3, HIGH);
// Set INT0 interrupt:
attachInterrupt(0, interrupt0, FALLING);
}
void loop()
{
Serial.println(count0);
Serial.println(count1);
delay(1000);
}
void interrupt0()
{
Serial.println("Interrupt0");
count0++;
}

Uploaded with
ImageShack.us