0Pricing
Arduino & IoT Academy · Lezione

Collegare un pulsante su una breadboard

Collegare correttamente un pulsante con un pull-up

Collegare un pulsante su una breadboard è una lezione Arduino & IoT Academy gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Arduino & IoT Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Arduino & IoT Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

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! 🎉

Domande Frequenti

La lezione «Collegare un pulsante su una breadboard» è gratuita?

Sì — il testo completo di «Collegare un pulsante su una breadboard» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Arduino & IoT Academy, passa a CoddyKit PRO. Il corso Arduino & IoT Academy include 4 lezioni in totale.

Cosa imparerò in «Collegare un pulsante su una breadboard»?

Collegare correttamente un pulsante con un pull-up Eserciti Arduino & IoT Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Arduino & IoT Academy?

Non è richiesta alcuna esperienza precedente. Arduino & IoT Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.

Quanto tempo richiede la lezione «Collegare un pulsante su una breadboard»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Arduino & IoT Academy?

Sì. Ogni lezione Arduino & IoT Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. INPUT e INPUT_PULLUP
  2. Leggere lo stato di un pulsante
  3. if/else: il LED segue il pulsante
  4. Collegare un pulsante su una breadboard
← Torna a Arduino & IoT Academy