Become a leader in the IoT community!
New DevHeads get a 320-point leaderboard boost when joining the DevHeads IoT Integration Community. In addition to learning and advising, active community leaders are rewarded with community recognition and free tech stuff. Start your Legendary Collaboration now!
Instead of clearing the flag inside the ISR, try disabling the interrupt *before* modifying the `OCR1A` value by adding `bitClear(TIMSK1, OCIE1A);` before setting `OCR1A` in the `passage_a_0` function. This should prevent multiple interrupts from being triggered.
@camila_9900 The issue you’re facing with the `ISR` in your code is likely due to a timing problem when clearing the `OCIE1A` bit inside the interrupt. When you clear this bit within the `ISR`, it may cause the interrupt to trigger prematurely, as if `OCR1A` were set to 0. However, if you don’t clear the `bit|, the `ISR` works but gets triggered multiple times before the next zero-cross event.
CONTRIBUTE TO THIS THREAD