Interrupt Triggering by itself

I have a problem where my Arduino is triggering an interrupt all by itself from start up. I've had the code working all the time up to just now and i cant figure out why this is. I've disconnected all pins on the Arduino Mega and stripped the code down to the bare minimal but the interrupt still triggers constantly.

Heres my code:

int location=0;

void setup()
  pinMode(19, INPUT);    //Decoder Clock
  attachInterrupt(4, increment, RISING); //pin 19
  Serial.println("Location of Motor.");

void loop()

void increment()

and my serial window shows Location of Motor.

2 3 4 5 6 7 8 9 10 11 12 etc...

Does anyone know why this happens? The only connection to the Arduino is the USB connection to the computer. All pins are disconnected.

Could be noise?

(Note: best not to put serial I/O in an interrupt service routine - if you want to print the value, put it in "loop")

It cant be noise because I disconnected all pins. The problem is that the interrupt is triggered even though there is no rising edges.

I put the serial print in void loop but i get the same result could it be my arduino thats faulty?

It cant be noise because I disconnected all pins.

It can especially be noise because you disconnected all pins. The pin should be held one way or the other by a resistor. The inputs on an arduino are extremely high impedance and will wander up an down in the presence of any electrical signals in the vicinity. You can hold a pin high with the internal pull up resistors by writing the pin high after declaring it as an input as in this pulled out of a bit of my code :

pinMode(gasdigPin, INPUT);
digitalWrite(gasdigPin, HIGH); // internal pull up

You'll need an external resistor between Gnd and the pin to hold it low (10k is a reasonable value).

ah thanx so much for that, solved my problem, i just assumed that the disconnected pins remained at 0 volts at all times. thanks again!

Actually disconnected pins will behave totally erratic. They may pickup noise. Or they may float slowly or they may do any other strange stuff, including things like increasing your power consumption for no obvious reasons.