LED With Pushbutton

by tejbho305 in Circuits > Arduino

50 Views, 0 Favorites, 0 Comments

LED With Pushbutton

51fk5okknvL._AC_UF1000,1000_QL80_.jpg

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

Attach the Pushbutton

IMG_2485.jpg

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.

Finish Wiring the Pushbutton

IMG_2486.jpg

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.

Connect the LED

IMG_2487.jpg

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.

Write the Program

Screenshot 2025-01-19 at 6.19.13 PM.png

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.

Downloads

Test the Circuit

IMG_2487.jpg

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

Downloads