0Pricing
Arduino & IoT Academy · Lesson

Wire a Button on a Breadboard

Connect a push button cleanly with a pull-up.

Wire a Button on a Breadboard is a free Arduino & IoT Academy lesson on CoddyKit — lesson 4 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.

Time to Build It

You've written the code; now make it real. You'll wire a push button on a breadboard so the Arduino can actually feel your press.

Meet the Push Button

A tactile push button has four legs, but they're really just two pairs. Pressing it connects one pair to the other inside.

Mind the Center Gap

Straddle the button across the breadboard's center gap. That keeps the two sides separate until a press bridges them together.

Lean on the Internal Pull-Up

Thanks to INPUT_PULLUP, you skip the external resistor entirely. The board holds the pin HIGH for you, so wiring stays tiny.

One Leg to the Pin

Run a jumper from one button leg to a digital pin, say pin 2. This is the line the Arduino will read for presses.

Other Leg to Ground

Connect the opposite leg to GND. When you press, the pin gets pulled down to ground and your code sees LOW.

Use the Diagonal Legs

Because the legs are paired, wire to ones that sit diagonally across the button. That guarantees you bridge the two real contacts.

Power Off While Wiring

Unplug the USB before moving wires. Building with the board powered off avoids shorts and protects the Arduino from mistakes. 🔋

Match Code to Wiring

Your sketch must name the same pin you wired. Set pin 2 to INPUT_PULLUP so the software and the hardware agree.

void setup() {
  pinMode(2, INPUT_PULLUP);
}

Test with Serial

Upload, open the Serial Monitor, and press. Seeing the value drop to 0 confirms your button and wiring both work.

Troubleshoot Calmly

No change on press? Check the diagonal legs, confirm the GND wire, and make sure the code uses the exact pin you plugged into.

Quick Check

Think about where the button's two legs should connect.

Recap

You wired a button across the center gap, one leg to pin 2 and one to GND, then confirmed it on Serial. You can now sense the real world! 🎉

Frequently asked questions

Is the “Wire a Button on a Breadboard” lesson free?

Yes — the full text of “Wire a Button on a Breadboard” 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 “Wire a Button on a Breadboard”?

Connect a push button cleanly with a pull-up. 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 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Wire a Button on a Breadboard” 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. INPUT vs INPUT_PULLUP
  2. Reading a Button State
  3. if/else: LED Follows the Button
  4. Wire a Button on a Breadboard
← Back to Arduino & IoT Academy