(solved)Arduino UNO problem with interrupts

Hey guys!

I was using the Arduino UNO interrupts for the motor encoders when i started detecting an unexpected behaviour. Then i began searching for the problem and finally i ended up with just the Arduino UNO (no sensors, NOTHING connected). As explained in http://www.arduino.cc/en/Reference/AttachInterrupt the interrupts 0 and 1 correspond to ports 2 and 3 respectively. However this is not what i'm getting:

Pins 2, 3 and 4 respond to interrupt 0 (the one suposed to be attached to pin 0).

At the beginning i thought it could be due to some "internal short circuit / bad soldered pins" however after changing to another Arduino ONE board that I own i got the same result!!!

Is anybody getting this behavior as well?

Thanks,
Víctor.

Note that if you leave an input pin floating it will pick up random radio signals and capacitively couple to adjacent pins. This is also true of interrupt inputs. Add a pull-down or pull-up resistor and try your experiment again.

Thanks for your answer!! That was exactly the problem. Just for the report this simple code makes it clear:

int pin = 13;
volatile int state = LOW;

void setup()
{
  pinMode(pin, OUTPUT);
  pinMode(2, INPUT);
  digitalWrite(2, HIGH); // pull up resistor
  pinMode(3, INPUT);
  digitalWrite(3, HIGH); // pull up resistor
  
  attachInterrupt(0, blink1, RISING);
  attachInterrupt(1, blink2, RISING);
  
  Serial.begin(9600); // send and receive at 9600 baud
}

void loop()
{
  digitalWrite(pin, state);
}

void blink1()
{
  Serial.println("Called interrupt1");
  state = !state;
}

void blink2()
{
  Serial.println("Called interrupt2");
  state = !state;
}

Thanks again and best regards,

Víctor