LESSON 29: The Dos and Don’ts of Arduino Software Interrupts

This is a follow on to lesson 28, to address some of the questions that come up. It is important to understand that all functions are not well suited for use with software interrupts. You must be mindful of timing. Key to being successful with Arduino Software Interrupts is the function called needs to be small and very fast. When the interrupt calls the function, you need to get in and out of that function as quick as you can. Hence, you should avoid doing printing in the function called by the interrupt. You should try and avoid working with serial data, because things can get lost if you are not careful. Also, you should know that you can not use a delay in the function.

For most beginner programmers, interrupts should just be used to call short functions, with minimal lines of code, that can be run quickly.