Input-Output with Button and LED

 

In this experiment, we will learn how to use button and control LEDs.

Components Used: 

  • 1 x Arduino Uno ( You can use other boards also )
  • 6 x Jumper Wires M-M
  • 4 x LED
  • 4 x Resistor 330 Ohm
  • 1 x Breadboard
  • 1 x Tactile Push Button

    Description

    By this experiment, we will learn to use push button and control the LEDs. This is a circuit which introduces the concept of input/output programming. The output is 4 LED’s and the input being a push button.

    MIN REQUIRED:20

Procedure

  1. Take Breadboard.
  2. Take 4 LED it will have one big leg (+) which is a positive and small leg which is Negative.
  3. Press that two legs and remember which one is a big one ( You can even bend big leg so it’s easy to identify for further reference.
  4. Now take M-M jumper wires
  5. Fix the small leg of led(-) to the negative sign on the breadboard and big led to the vertical connection on the breadboard.
  6. Now take 4 resistors connect them to each big leg of led(+) and then connect them through jumper wire to 6,8,10 and 12 no. of digital pins in the Arduino.
  7. Now through the jumper wire  +5 V to the positive sign(+) in breadboard and GND to the negative sign(-) in the breadboard.
  8. Now take the push button and connect one leg to the resistor and the connect resistor through then to the Negative sign (-) on the breadboard.
  9. Take other leg of a push button and connect to the Positive sign of the Breadboard.
  10. Now take the push button leg to digital pin 4 of Arduino.
  11. Connect Arduino to your Laptop/PC by USB Cable. ( we use A to B USB cable for Arduino which is also used in printers )
  12. Open Arduino IDE ( You can download it from here or you can use online platform Arduino Web editor )
  13. Type the code Below given.
  14. Check program and then upload it.
LINES OF CODE

Previous article Display Intensity of light with LDR Sensor
Next article Check Distance in Serial Monitor
Close