Library

Moore · Rational transduction

A switch debouncer

A mechanical switch chatters, so its reading flips briefly before it settles. The debouncer changes its output only after the input has held the new value for three samples in a row; shorter glitches are ignored. Each state is the current output and how long the other value has been seen.

lo0lo1lo2hi0hi1hi2010101101010
The machine as drawn — 6 states, 12 transitions.

The author’s examples, run

0 → reject · 001 → reject · 0000 → reject · 00001 → reject · 000000 → reject · 00001111101100011000 → reject · 00011111111000000