An interrupt is a signal that makes the processor pause its current work, run a short piece of code called an interrupt service routine (ISR), and then go back to what it was doing. It lets a program react quickly to events without checking for them all the time.
How it works: 1) An event occurs, such as a button press, a timer reaching its value or data arriving. 2) The processor saves its place and jumps to the ISR for that event. 3) The ISR does its short task, such as setting a flag. 4) The processor returns to the main program. The alternative, called polling, checks the input again and again.
Keep ISRs short and fast. Do long work in the main loop, and be careful with variables shared between the ISR and the main program.
What event would you handle with an interrupt in a project of yours?