Introduction: LED With Pushbutton

About: I am a student at American High School. I love math, programming, and building circuits!

This circuit will have the LED turn on when the pushbutton is pressed.

Supplies

  1. Elegoo Uno R3 microcontroller board
  2. Breadboard
  3. Laptop
  4. Pushbutton
  5. 10k ohm resistor
  6. 330 ohm resistor
  7. LED
  8. USB cable

Step 1: Attach the Pushbutton

Connect the 10k resistor and pushbutton as shown. One wire goes from 5V to the left side of the resistor. Another goes from the right side of the resistor to the left side of the pushbutton.

Step 2: Finish Wiring the Pushbutton

Add one wire going from the right side of the resistor to pin 12. And add one wire going from the right side of the push button to ground.

Step 3: Connect the LED

One wire goes from pin 8 to the left side of the 330 ohm resistor. The right side is connected to the long end of the LED. The short end of the LED is connected to another wire which goes to ground.

Step 4: Write the Program

You must have Arduino IDE installed: https://www.arduino.cc/en/software

Here is the code: https://github.com/tejbho/ArduinoProjects/blob/main/pushbutton/pushbutton.ino

You should modify the code so the LED pin is 8 and the button pin is 12.

Step 5: Test the Circuit

Try pressing the button to see if the LED turns on.