I'm new to Arduino.
I want to use pin change interrupt PCINT0.
I connected a mechanical switch to PCINT 3.
the switch has no filtering so as I get into the ISR(PCINT0_vect) i disable PCINT0 (tried also only to disble PCINT 3).
here is the code:
//Pin change interrupt
/* interrupt code here */
PCICR = 0; //disable pin change interrupts
PCMSK0 &= 0xF7; //set bit 3 to 0 mask PCINT 3 - Disable PCINT 3
//Serial.print("PINB "); Serial.print(PINB); //Read port values for test only
//digitalWrite(ledGreen,!digitalRead(ledGreen)); //for test only
and it works.
the problem is when i re-enable it after few seconds some times the interrupt occur again, only one after enabling it without touching the switch.
I also see that PCIFR = 0 when it enters the ISR.
if then I will enable it again and will not touch the switch anymore the interrupt will not occur.
I switch input is configured to use the internal pull-up.