How to use interrupts with Raspberry Pi Pico
#379
·
Pro
Imagine you are watching a movie, and there is a knock at the door. You press pause, answer the door, and there is a salesman. Uninterested, you send them away and are back at your living room. You sit down and press play. That is an example of an interrupt. You were doing something, you were interrupted, and you then did something to handle the interrupt before going back to doing what you were doing before. In electronics, there are also interrupts. In this context, an interrupt is a signal emitted by hardware or software when an event needs immediate attention.
You can think of an Interrupt Service Routine as a special block of code. It's also known as an interrupt handler or ISR for short. Basically, it is a software process invoked by an interrupt request from a hardware device. For example, they can be are executed in response to an event such as a voltage change on a pin. In this lesson, we will learn how to use hardware interrupts with a push button and the Pico