Lets try again. Based on your tutorial ESP8266 interrupts and timers I am using interrupts to act on PIR sensor going on and off. I have two interrupt handlers, one triggered on RISING and the other on FALLING edge of the same pin.
So I have. code
attachInterrupt(digitalPinToInterrupt(14), detectsMovement, RISING); and
attachInterrupt(digitalPinToInterrupt(14), noMovement, FALLING);
my problem is the RISING isr does not trigger while the FALLING isr works fine I have verified the voltage change on pin 14 going from a few mv to 3.3 volts but the isr is not called.
the called functions semply set a boolean flag and return.
So at this point I am looking for clues. Thanks
Does it detect the RISING change when using just one interrupt handler?
Have you tried using a wire instead of the PIR motion sensor to check if it is not related with the sensor? If you have an oscilloscope, you can check the PIR motion sensor behavior in a better detaill and check if something is wrong, or if you need to adjust the sensor delay.
I’m fairly sure you can’t do that. For each pin you can have either RISING, FALLING or CHANGE. In your code, whatever attachInterrupt is last will be attached to the pin. I believe you need to change it to one attachInterrupt for that pin and use the CHANGE mode.
Another option is to use an attachInterrupt on a different pin and then tie the two pins together.
Thank you. If my approach is not permitted I guess I will try The double pin approach and tie the PIR output to Two input pins that are wired together. I really don’t want to use the CHANGE mode and have to do tests in the ISR to determine up or down.
Thanks for the suggestion, Steve.
Richard, then let us know if you were able to solve the problem.
Hi Sara; I have verified that Steve is right. My approach is not permitted. I tested this by reversing the order in my code, placing the rising condition last. This compiled and ran correctly and as predicted, ignored the first ISR. I now have the code working my using the two pin approach. Thanks again to you and Steve.