Interrupt (arduino)
We Interrupt This Broadcast…
When writing an Interrupt Service Routine (ISR):
- Keep it short
- Don’t use delay ()
- Don’t do serial prints
- Make variables shared with the main code volatile
- Variables shared with main code may need to be protected by “critical sections” (see below)
- Don’t try to turn interrupts off or on
INPUT or INPUT_PULLUP
Analog Comparator Interrupt
More than 2 pin interrupts
- “pin change” type interrupts.
- Multiple pin change interrupt
- Pin Change Interrupts If you choose your interrupt pins carefully you can have up to 5 pins that each have their own interrupt handler. After that you then have to start sharing a handler and you have to add some extra code to figure out which pin caused the interrupt.
Written on August 7, 2019, Last update on August 13, 2019
arduino
interrupt