Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Generally, it is advised to keep vector routines as small as possible and keep delay functions away from it to avoid computational clashes. Might be the case of priority too. The interrupt section says about the ISR's that:

Generally, an ISR should be as short and fast as possible. If your sketch uses multiple ISRs, only one can run at a time, other interrupts will be executed after the current one finishes in an order that depends on the priority they have. millis() relies on interrupts to count, so it will never increment inside an ISR. Since delay() requires interrupts to work, it will not work if called inside an ISR. micros() works initially, but will start behaving erratically after 1-2 ms. delayMicroseconds() does not use any counter, so it will work as normal.

Generally, it is advised to keep vector routines as small as possible and keep delay functions away from it to avoid computational clashes. Might be the case of priority too. The interrupt section says about the ISR's that:

Generally, an ISR should be as short and fast as possible. If your sketch uses multiple ISRs, only one can run at a time, other interrupts will be executed after the current one finishes in an order that depends on the priority they have. millis() relies on interrupts to count, so it will never increment inside an ISR. Since delay() requires interrupts to work, it will not work if called inside an ISR. micros() works initially, but will start behaving erratically after 1-2 ms. delayMicroseconds() does not use any counter, so it will work as normal.

Might just be a case of timing issue, since spinOnce(); is being called.