Hello everyone, I am having such a nightmare to make it work, I am using a WEMOS D1R1 to handle the movement of an encoder via external interrupts.
Instead if detecting the edge (L to H), it detects the status, so the interrupt function repeats continuously if the state is H, so its behaving like a while(state==H){...}, instead of triggering once per H to L .
Here is my code so far:
void ICACHE_RAM_ATTR ISRC();
void setup() {
Serial.begin(115200);
pinMode(D9,OUTPUT);
pinMode(D8, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(D8), ISRC, RISING);
Serial.println("Started");
}
void loop()
{}
//This function is supposed to get executed when interrupt happens, instead it happens looply while D8 is HIGH
void ISRC() {
Serial.println("Interrupt Detected");
}
I dont know what else to try here is what the monitor says, please, note the time marks:
20:41:49.935 -> Interrupt Detected
20:41:49.935 -> Interrupt Detected
20:41:49.935 -> Interrupt Detected
20:41:49.935 -> Interrupt Detected
[...]
I have readed here that setting the input as INPUT_PULLUP fixes the issue, but it didnt happen with me.
I had tried wiring the interrupt input (D8), to a "clean" source, as it is the BUILTIN_LED (D9) pin, and then it does work perfectly.
The problem comes when I connect it to the encoder or a button.
I guess its a bouncing problem...
How can I avoid this supposed bouncing?
Is it really a bouncing problem?
How can I make it work?
Thanks everyoune in advance.