There is a wire connected to the Arduino Uno at pin2. I have a DC power supply(set to just slightly under 5V) which is connected to this wire. When i have the program running without the else if statement(just setting the output pin to HIGH, instead of HIGH and LOW), and i turn on the supply the program works as expected(So noise isn't what's triggering that pin). This is provided that I give the interrupt a significant delay time(in which case it would still be in the interrupt if bouncing is occuring).
int scanPin = 2;
volatile int outInter = 9;
void setup() {
Serial.begin(9600);
pinMode(scanPin, INPUT);
pinMode(outInter, OUTPUT);
attachInterrupt(0, interFunc,CHANGE);
}
void interFunc(){
//if(digitalRead(scanPin)==HIGH){
for(int i=0; i<1000; i++)
{delayMicroseconds(3000);}
// digitalWrite(outInter, HIGH);}
// else if(digitalRead(scanPin)==LOW){
// for(int i=0; i<1000; i++)
//{delayMicroseconds(16);}
digitalWrite(outInter, HIGH);
// }
}
void loop() {
}