ブレッドボードにボタンを配線する
プルアップを使ってプッシュボタンをきれいに接続します
「ブレッドボードにボタンを配線する」はCoddyKit上の無料Arduino & IoT Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはArduino & IoT Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Arduino & IoT Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
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! 🎉
よくある質問
「ブレッドボードにボタンを配線する」レッスンは無料ですか?
はい。「ブレッドボードにボタンを配線する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Arduino & IoT Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Arduino & IoT Academyコースには全4レッスンが含まれています。
「ブレッドボードにボタンを配線する」で何を学びますか?
プルアップを使ってプッシュボタンをきれいに接続します ブラウザで直接実行するハンズオンコードでArduino & IoT Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Arduino & IoT Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのArduino & IoT Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「ブレッドボードにボタンを配線する」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このArduino & IoT Academyレッスンでコードを書いて実行できますか?
はい。すべてのArduino & IoT Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- INPUT と INPUT_PULLUP
- ボタンの状態を読み取る
- if/else: ボタンに LED を連動させる
- ブレッドボードにボタンを配線する