The code, working with interrupt need some correction.
You attach detectsMovement function as interrupt handler and declare it:
void detectsMovement() {...}
But correct code must be:
void IRAM_ATTR detectsMovement() {...}
IRAM_ATTR need for place interrupt code to RAM, otherwise code stored in flash
More text in this link:
https://www.esp32.com/viewtopic.php?t=4978
Please, correct your code
1 Answers
Hi! Thanks for the great tip.
I’ve just tried it myself and read about it, it’s definitely faster and better method.
I’ve updated the online version of the course: https://rntlab.com/esp32-with-pir-motion-sensor-interrupts-and-timers/ (ESP32 with PIR Motion Sensor)
The eBook will have that change too in the next update.