Handling GPIO-connected switches robustly in C on the Raspberry Pi

from blog Kevin Boone's website, | ↗ original
It's surprisingly difficult to detect switch actuations in a robust way, dealing with contact bounce and other quirks. This article describes one approach to the problem in C.