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(16);}
digitalWrite(outInter, HIGH);}
else if(digitalRead(scanPin)==LOW){
for(int i=0; i<1000; i++)
{delayMicroseconds(16);}
digitalWrite(outInter, LOW);
}
}
void loop() {
}
PLEASE USE THE "#" CODE TAG BUTTON TO POST YOUR CODE.