Home / Learn Embedded C / Polling vs Event-Driven Design

Polling vs Event-Driven Design

Two fundamentally different architectural approaches to structuring an embedded program's main loop.

Bottom lineTwo fundamentally different architectural approaches to structuring an embedded program's main loop.

Breaking it down

Polling vs event-drivenPollingSimple to reason aboutWastes CPU/power re-checkingunchanged stateEvent-drivenEfficient, works well withsleep modesMore interrupt-handlingcomplexity
Polling vs event-driven

What it is

Polling-based design repeatedly checks each input/condition in a loop looking for changes; event-driven design reacts to interrupts or flags set by them, only doing work when something has actually happened, rather than continuously re-checking.

Why it matters

This is a recurring architectural choice threading through this entire course (GPIO polling vs pin-change interrupts, UART polling vs receive interrupts) — this lesson names and generalizes the pattern so it can be applied deliberately to new design decisions.

Mechanically speaking

Pure polling wastes CPU time (and power, connecting back to the Low Power Design group) continuously checking things that have not changed; pure event-driven design adds interrupt-handling complexity but can be dramatically more efficient, especially combined with sleep modes.

Shows up in

  • Main loop architecture decisions
  • Power-conscious design
  • Course-wide pattern recognition

Try it

Counting wasted checks under polling vs an event-driven equivalentC: edit and run

Polling spends CPU time on every tick regardless of whether anything changed; an event-driven design only runs at the one tick that actually mattered.

Try it: polling at two different rates

Comparing total checks performed at a fast vs slow polling intervalC: edit and run

Even within pure polling designs, the chosen poll interval itself trades responsiveness against wasted CPU work — a slower poll means fewer wasted checks but more latency.

Check yourself

1. Why does event-driven design generally combine better with low-power sleep modes than pure polling?