Strange Interrupt Issue

Hi,
I am having a weird issue with an interrupt.
I have an external power (12V) source that runs through a voltage regulator (5V) then to two Arduinos.
Arduino 1 is the one with an issue.
The interrupt is a simple momentary button for travel limiting.
It is wired from Pin5 which supplies power through the switch then to Pin 2 which is the interrupt.
When I connect the external power via Vin, the interrupt stops working.
If I disconnect the Vin, it begins working again.
Also, when i connect a resistor (1K) to pin 2 and dangle an alligator connect from it, with the interrupt still attached, it starts working again.
The other end of the alligator clip is connected to nothing it is just dangling there.
If I take away the alligator clip and just have one side of the resistor in there is does not work either.

Any Ideas about what is going on or a solution that does not involve the alligator clip?
Code Below:

//Swtich Interupt
const int LimitSwitch = 5;			//Sets Swtich Interupt Output Pin to 5;

void setup() {
  pinMode(LimitSwitch, OUTPUT);		//Initializes Switch Pin to Output
  digitalWrite(LimitSwitch, HIGH);		//Pin 5 HIGH  
  Serial.begin(115200);
  attachInterrupt(0, StrokeLimit, FALLING);
}

void loop() {
}

//###############################################################
//############################ Stroke Limit #####################
//###############################################################
//Detected Interaction
void StrokeLimit(){
	Serial.println("Stroke Limit Detected");	//Print Interation Detected in Serial Monitor
}

Thanks,
Ditch

Sounds like a "floating" pin.
Did you use a (10k) pulldown resistor from switch pin to ground.

Or better/safer, wire the switch between pin and ground, and use INPUT_PULLUP in pinmode.
If you do, invert the switch logic.
Leo..

Thanks, I will give that a shot.

I'm not clear on your operational problem, but your trouble shooting routine is not correct.

You can not have a Serial print out within an ISR because serial print relies on interrupts, and they are disabled within the ISR.

Set a flag within the ISR, and then test for that flag within the loop and call the print out if the flag is set.

//Swtich Interupt
const int LimitSwitch = 5; //Sets Swtich Interupt Output Pin to 5;
volatile boolean flag = false;

void setup() {
 pinMode(LimitSwitch, OUTPUT); //Initializes Switch Pin to Output
 digitalWrite(LimitSwitch, HIGH); //Pin 5 HIGH  
 Serial.begin(115200);
 attachInterrupt(0, StrokeLimit, FALLING);
}

void loop() {
if (flag == true){
 Serial.println("Stroke Limit Detected");
 flag = false;
}

}

//###############################################################
//############################ Stroke Limit #####################
//###############################################################
//Detected Interaction
void StrokeLimit(){
        flag = true;

//Serial.println("Stroke Limit Detected"); //Print Interation Detected in Serial Monitor
}

Thanks Guys,
Correcting both Issues solved my problem!

Why are you using an interrupt to detect a mechanical switch?
That's like driving a car instead of walking 10 yards.
Switch bounce will mean that it will call your interrupt routine several (maybe hundreds of) times for every switch closure and opening. Instead, poll the state of the switch in loop() and use a debounce routine.