Press a button to light an LED
Read the pushbutton on D2 with an internal pull-up. Light the D9 LED while pressed and report pressed as 1 or 0 at 115200 baud.
Read the pushbutton on D2 with an internal pull-up. Light the D9 LED while pressed and report pressed as 1 or 0 at 115200 baud.
Use the Uno R3 Learning Kit. Build with power disconnected, check the labelled connections, then upload the supplied sketch. Drag or zoom the 3D model to inspect it from any angle.
Step 1 — Watch the complete build
Press Play for the narrated build. You can rotate and zoom the model while it plays, or follow the individual steps below.
Loading assembly…
Keep U S B disconnected while you build. On this breadboard, each group of five holes shares a connection; the centre channel separates the two halves. You can drag the 3D view to look around. Connect Arduino ground to the ground rail. Add the Red tactile button. Its Pin 4 lead goes into column 10 row F; the highlights show the remaining holes. Add the Red L E D · 5 millimetres. Its cathode lead goes into column 22 row C; the highlights show the remaining holes. Add the 330 ohms resistor. Its Pin 0 lead goes into column 23 row E; the highlights show the remaining holes. Connect Arduino digital pin 2 to the button’s Pin 1 pin. Connect the button’s Pin 3 pin to the ground rail. Connect Arduino digital pin 9 to the other end of the resistor. Connect the L E D’s cathode lead to the ground rail. Check all wiring. Connect the square U S B-B plug to the Uno and the U S B-A plug to your computer. Use Verify and Upload in the code editor below.
Step 2 — Understand the breadboard
Keep USB disconnected while you build. On this breadboard, each group of five holes shares a connection; the centre channel separates the two halves. You can drag the 3D view to look around.
Loading assembly…
Keep U S B disconnected while you build. On this breadboard, each group of five holes shares a connection; the centre channel separates the two halves. You can drag the 3D view to look around.
Step 3 — Connect Uno GND → T- rail 1
Connect Arduino ground to the ground rail.
| Connect | To |
|---|---|
| Uno GND | T- rail 1 |
Loading assembly…
Connect Arduino ground to the ground rail.
Step 4 — Place Red tactile button
Add the Red tactile button. Its Pin 4 lead goes into column 10 row F; the highlights show the remaining holes.
Exact breadboard holes
- button · Pin 4 → column 10 row F
- button · Pin 1 → column 12 row D
- button · Pin 2 → column 12 row F
- button · Pin 3 → column 10 row D
Loading assembly…
Add the Red tactile button. Its Pin 4 lead goes into column 10 row F; the highlights show the remaining holes.
Step 5 — Place Red LED · 5 mm
Add the Red LED · 5 mm. Its cathode lead goes into column 22 row C; the highlights show the remaining holes.
Exact breadboard holes
- led · cathode → column 22 row C
- led · anode → column 23 row C
Loading assembly…
Add the Red L E D · 5 millimetres. Its cathode lead goes into column 22 row C; the highlights show the remaining holes.
Step 6 — Place 330 Ω resistor
Add the 330 Ω resistor. Its Pin 0 lead goes into column 23 row E; the highlights show the remaining holes.
Exact breadboard holes
- r · Pin 0 → column 23 row E
- r · Pin 1 → column 23 row H
Loading assembly…
Add the 330 ohms resistor. Its Pin 0 lead goes into column 23 row E; the highlights show the remaining holes.
Step 7 — Connect Uno D2 → column 12 row A
Connect Arduino digital pin 2 to the button’s Pin 1 pin.
| Connect | To |
|---|---|
| Uno D2 | column 12 row A |
Loading assembly…
Connect Arduino digital pin 2 to the button’s Pin 1 pin.
Step 8 — Connect column 10 row A → T- rail 10
Connect the button’s Pin 3 pin to the ground rail.
| Connect | To |
|---|---|
| column 10 row A | T- rail 10 |
Loading assembly…
Connect the button’s Pin 3 pin to the ground rail.
Step 9 — Connect Uno D9 PWM → column 23 row J
Connect Arduino digital pin 9 to the other end of the resistor.
| Connect | To |
|---|---|
| Uno D9 PWM | column 23 row J |
Loading assembly…
Connect Arduino digital pin 9 to the other end of the resistor.
Step 10 — Connect column 22 row A → T- rail 22
Connect the LED’s cathode lead to the ground rail.
| Connect | To |
|---|---|
| column 22 row A | T- rail 22 |
Loading assembly…
Connect the L E D’s cathode lead to the ground rail.
Step 11 — Place USB-A to USB-B cable · Uno
Check all wiring. Connect the square USB-B plug to the Uno and the USB-A plug to your computer. Use Verify and Upload in the code editor below.
Loading assembly…
Check all wiring. Connect the square U S B-B plug to the Uno and the U S B-A plug to your computer. Use Verify and Upload in the code editor below.
Step 12 — Program your Uno
Choose Arduino Uno. Verify, pair the board and Upload this sketch. Keep USB connected. Read the pushbutton on D2 with an internal pull-up. Light the D9 LED while pressed and report pressed as 1 or 0 at 115200 baud.
Step 13 — Explore the live readings
Press and release the button. The LED follows your hand. The kit includes five switches; try another after disconnecting power.
Step 14 — Troubleshooting
If it always reads pressed, both wires may be on the same internally connected pair. Rotate your view and check the highlighted opposite sides.
Parts List
Required Parts (1)
Use the components named in this tutorial. A computer and any additional power supply are not included.
x1
$64.70
In stockProject Summary
1 part total
Unavailable items will be skipped