0Pricing
Arduino & IoT Academy · Lesson

Why Buttons 'Bounce'

See the false triggers a contact creates.

Why Buttons 'Bounce' is a free Arduino & IoT Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Arduino & IoT Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

One Press, Many Signals

You press a button once, but your Arduino may see several presses. This sneaky problem is called bounce, and it trips up almost every beginner. 😅

Inside a Push Button

A button is just two metal contacts that touch when you press. They feel solid to your finger, but at the microsecond level they are anything but.

Metal That Chatters

When the contacts meet, they physically vibrate for a few milliseconds before settling. Each tiny touch and break is a separate electrical event.

What the Pin Sees

During that vibration, the pin reads a burst of rapid HIGH-LOW flips instead of one clean change. Your code can count every flip as a press.

Why the Loop Catches It

Your loop() runs millions of times per second, far faster than the bounce settles. So it samples the noise again and again.

A Counter Gone Wild

Picture a counter that adds one per press. One real tap can jump it by three or four because of multiple false triggers.

if (digitalRead(BTN) == LOW) {
  count++;  // may fire several times per tap
}

It Happens on Release Too

Bounce strikes when you let go as well, not just when you press. Both edges of the signal can stutter and confuse your logic.

How Long It Lasts

Most bounce settles within about 5 to 20 milliseconds. It is brief, but to a fast microcontroller that is an eternity of noise.

Spot It Yourself

Print a message every time the pin goes LOW and tap once. Seeing several lines in the Serial Monitor proves bounce is real.

if (digitalRead(BTN) == LOW)
  Serial.println("pressed");

Hardware or Software Fix

You can tame bounce with a small capacitor in the circuit, or with timing logic in code. Software is cheaper and far more common.

The Core Idea

The fix is to wait briefly after the first change and ignore the rest. Confirm the button is truly stable before you act on it.

Quick Check

Let's confirm what causes a button to bounce.

Recap: Bounce Basics

You learned that a button's contacts bounce, sending noisy flips that fool fast code. Next you'll silence that noise with simple timing. 🎯

Frequently asked questions

Is the “Why Buttons 'Bounce'” lesson free?

Yes — the full text of “Why Buttons 'Bounce'” is free to read here on the web, and the Arduino & IoT Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Arduino & IoT Academy course, upgrade to CoddyKit PRO.

What will I learn in “Why Buttons 'Bounce'”?

See the false triggers a contact creates. You practise Arduino & IoT Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Arduino & IoT Academy?

No prior experience is required. Arduino & IoT Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Why Buttons 'Bounce'” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Arduino & IoT Academy lesson?

Yes. Every Arduino & IoT Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Why Buttons 'Bounce'
  2. Debounce with millis()
  3. Store a Value in EEPROM
  4. Remember a Counter After Reset
← Back to Arduino & IoT Academy