You are on page 1of 5

MARWADI EDUCATION FOUNDATION’S GROUP OF INSTITUTIONS

FACULTY OF ENGINEERING, GAURIDAD CAMPUS.


DEPARTMENT OF COMPUTER ENGINEERING

Experiment 3
Title: Experiment using Arduino Uno to keep Buzzer/Led On /Off.

Experiment Description: Analyzing the use of Arduino UNO to control the


LED / Buzzer along with its application.

Components:
1. Arduino Uno board
2. LED
3. Resister
4. USB
5. Jumper wires

Steps to perform:

Step-1: Take an Arduino Uno board, a LED, and a Resister.

Step-2: Connect the cathode pin of led to the GND pin. And connect the Anode pin of led to the
resister and further connect resister to any digital pin of Arduino board. Here we connected resister
with pin number 2.

IOT AND APPLICATIONS (3160716) 200570107099 30


MARWADI EDUCATION FOUNDATION’S GROUP OF INSTITUTIONS
FACULTY OF ENGINEERING, GAURIDAD CAMPUS.
DEPARTMENT OF COMPUTER ENGINEERING

Step-3: Now Connect the blocks as shown in figure. Set pin 2 to High to on the LED, then wait
for 1 second and set pin 2 to low to off the LED, and again wait for the 1 second. Forever block
is used to continue LED on /off.

Step-4: Now start simulation and observe the LED. (on/off LED will continue with delay of 1
second)

IOT AND APPLICATIONS (3160716) 200570107099 31


MARWADI EDUCATION FOUNDATION’S GROUP OF INSTITUTIONS
FACULTY OF ENGINEERING, GAURIDAD CAMPUS.
DEPARTMENT OF COMPUTER ENGINEERING

Step-5: Observe the code for the same.

IOT AND APPLICATIONS (3160716) 200570107099 32


MARWADI EDUCATION FOUNDATION’S GROUP OF INSTITUTIONS
FACULTY OF ENGINEERING, GAURIDAD CAMPUS.
DEPARTMENT OF COMPUTER ENGINEERING

Code:
void setup()
{
pinMode(2, OUTPUT);
}

void loop()
{
digitalWrite(2, HIGH);
delay(1000); // Wait for 1000 milliseconds(s)
digitalWrite(2, LOW);
delay(1000); // Wait for 1000 milliseconds(s)
}

Real Output:

IOT AND APPLICATIONS (3160716) 200570107099 33


MARWADI EDUCATION FOUNDATION’S GROUP OF INSTITUTIONS
FACULTY OF ENGINEERING, GAURIDAD CAMPUS.
DEPARTMENT OF COMPUTER ENGINEERING

Analysis:

This experiment shows how to use an Arduino uno to control an LED by turning it on and off at
specific interval using code. When we run the code, the LED connected to pin 2 on the Arduino
uno will turn on for 1 second and then turn off for 1 second, repeatedly. where ‘digitalWrite()’
function in the code, sends a signal to turn the LED ON or OFF based on the value passed to it
(HIGH for on, LOW for off).

Application:

1. Lighting: You can use an Arduino Uno to control the brightness and color of LEDs to
create custom lighting effects for your home or workspace.
2. Signaling: LEDs are commonly used in signaling devices, such as traffic lights or warning
lights. You can use an Arduino Uno to control the flashing patterns and colors of these
LEDs.
3. Display: You can use LEDs to create simple displays, such as a binary clock or a
temperature gauge. By using an Arduino Uno to control the LEDs, you can create dynamic
displays that change based on input from sensors or other data sources.
4. Games: LEDs can be used in simple games, such as a Simon Says game or a reaction time
test. By using an Arduino Uno to control the LEDs, you can create interactive games that
respond to player input.
5. Education: LEDs and the Arduino Uno are commonly used in educational settings to teach
basic electronics and programming concepts. By controlling the LEDs with the Arduino
Uno, students can learn about circuits, logic gates, and programming.

IOT AND APPLICATIONS (3160716) 200570107099 34

You might also like