Part 4: Interrupts

~45-60 min

So far, all your code has been polling — checking the button state in a loop, reading sensors repeatedly. This works, but it's wasteful. The CPU spins constantly even when nothing is happening.

Interrupts let the hardware notify your code when something happens. The CPU can do other work (or sleep) until an event occurs.

What You'll Do

  1. Interrupt-driven button — convert your polling button code to use interrupts
  2. Adaptation challenge — handle multiple inputs, explore different trigger configurations
  3. Debouncing (stretch goal) — handle the real-world problem of noisy button signals