Professional Documents
Culture Documents
Ep-1.2 21mca2001
Ep-1.2 21mca2001
Interface an Arduino Uno with two pushbuttons to design the different patterns and follow the
different cases. Use 6 different color LEDs and name them T1 to T6 and pull up resistors
of suitable values. Consider delay 200.
T1, T3 and T5 are in ON conditions and T2, T4 and T6 are in OFF conditions.
• Hardware Required:
• LED Lights
• Resistor
• Arduino UNO3
• Breadboard
• PushButtons
• Theory:
Arduino Uno is a microcontroller board that allows you to build electronics
projects by connecting sensors and other components to it. It is easy to use
and comes with a programming environment that simplifies the process of
writing code. It is used in a variety of applications, including robotics, home
automation, and many other projects.
A breadboard is a prototyping board used to build and test electronic circuits. It
has a grid of holes into which electronic components, such as resistors,
capacitors, and integrated circuits, can be inserted and connected without the
need for soldering. The holes are typically arranged in a series of parallel
rows and columns, allowing for easy circuit design and modification.
Breadboards come in various sizes and can be reused multiple times for
different projects. They are widely used by hobbyists, students, and
professionals for electronics prototyping and testing.
Pull Up and Pull Down
Pull-up and pull-down resistors are used in electronic circuits to ensure that a
digital input pin has a known state when it is not being actively driven by
another device. They are used to eliminate the possibility of the input pin
floating, which can lead to unpredictable behavior and can cause false
triggering of the input.
A pull-up resistor is used to ensure that the input pin is at a known HIGH state
when the switch or button is not pressed. The pull-up resistor is connected
between the input pin and the positive supply voltage (usually +5V). When
the switch or button is pressed, it connects the input pin directly to GND,
overriding the pull-up resistor and pulling the input pin to a LOW state.
A pull-down resistor is used to ensure that the input pin is at a known LOW state
when the switch or button is not pressed. The pull-down resistor is
connected between the input pin and GND. When the switch or button is
pressed, it connects the input pin directly to the positive supply voltage,
overriding the pull-down resistor and pulling the input pin to a HIGH state.
Implementation Steps:
Step-by-step explanation of how to interface an Arduino Uno with two pushbuttons
and six LEDs to follow the different cases you mentioned:
• Gather the materials: You'll need an Arduino Uno board, two pushbuttons,
six LEDs of different colors, six 220 ohm resistors, two pull-up resistors
with a value of 10k ohms, a breadboard, and some jumper wires.
• Connect the pushbuttons: Connect one end of each pushbutton to GND, and
the other end of each pushbutton to a digital pin on the Arduino board.
Connect a 10k ohm pull-up resistor between each digital pin and +5V.
• Connect the LEDs: Connect the anode (positive) leg of each LED to a digital
pin on the Arduino board, through a 220 ohm resistor. Connect the cathode
(negative) leg of each LED to GND.
• Write the code: Use the Arduino IDE to write a program that reads the state
of each pushbutton and controls the state of each LED accordingly. Use the
following logic:
• When pushbutton 1 is pressed, turn on all six LEDs, then turn off all
six LEDs.
• When pushbutton 2 is pressed, turn off LEDs T2, T4, and T6.
• Upload the code: Connect the Arduino board to your computer, select the
correct board and serial port in the Arduino IDE, and upload the code to the
board.
• Test the circuit: Press pushbutton 1 to turn on all six LEDs and press the 2nd
button to turn off the alternate LED’s.
• Arduino Code: