← all lessons
Microcontrollers · #8 of 20

GPIO Inputs

Floating, Pull-ups, Debouncing

Why it matters

A real button press should be one event. Without debouncing you get phantom presses, double-clicks, and flaky menus — even with perfect code everywhere else.

The idea

Goal

Turn a noisy mechanical switch into a clean digital signal you can trust.
        <h3>What's actually happening</h3>
        A switch is two pieces of metal touching. When they first touch, they bounce for a few milliseconds:
        HIGH/LOW/HIGH/LOW… then finally settle. Your CPU is fast enough to see all those transitions.

        <div class=

Demo

The top timeline is the raw GPIO signal (with bounce). The bottom is the debounced output.

Use: