Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
53 views5 pages

Exercise No. 2 Blinking LED

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 5

EXERCISE NO.

Blinking LED

Objectives: Connecting and operating LED connected to the digital outputs of an Arduino.

Equipment needed:

1. A computer (Windows, Mac, or Linux).

2. An Arduino-compatible microcontroller.

3. A USB A-to-B cable.

4. Budget Pack for Arduino (https://www.adafruit.com/product/193)


In the last lab experiment we have installed the software and also finished connected the Arduino
to the right communication port on your computer. In this lab we will learn how to connect a
device (LED in our case) and control it.
Procedure:

Part 1: Connecting Arduino to the computer

1. Open the Arduino IDE by clicking on the Arduino Icon.

2. Connect your Arduino to the computer using the USB cable.

3. Make sure you select the right board (see below screen-shot)
4. Then select the correct serial port. (see below screen-shot)

Part 2: Compiling and Uploading file to the Arduino

Pinout of Arduino UNO

1. Once you see your Arduino board is connected to your computer. Go to the File menu ->
Examples -> 01.Basics -> Blink.
2. This should open up a new window that has a tab labeled Blink. See below screen-shot for
description.

3. Then click on the Sketch menu and check for any typos / errors using verify button and
Compile to the machine language if the verification is successful.
4. If the above process is successful, you should see the message in the status bar showing
that the compilation is successful.

5. Now upload your program to the Arduino by clicking upload button in the Sketch menu.

6. You might face some issues from step 3-5 if you have not selected a correct board/serial
port. So please make sure you went through the part 1 carefully.

Part 3: Blinking LED


1. In the above Blink code you see bunch of lines performing certain operations. In our case, turning
on and off an LED connected to the Digital pin 13.
2. Most Arduinos have an on-board LED that is attached to digital pin 13. So, you must see the
LED on your board starting to blink. (In some cases, the boards are pre-installed with the
program. So the LED starts to blink once you have powered the Arduino )

In the code you can see that the OUTPUT is being taken from the digital pin 13. We can change
the output of the board by just changing the output pin numbers, i.e., see what happens if you
replace 13 with 12. (You have to upload every time to see the changes)
3. Before uploading your new code to the Arduino we have to make sure that LED is connected to
the Digital pin 12, if there is nothing connected we don’t have a way to see our result. Please
follow the below schematic for connecting the LED to the digital pins on the Arduino board. A
series resistor is mandatory for the circuit, it prevents the LED from burning out.
4. Now, you have a blinking LED controlled using an Arduino. Now, we can change the LED turn on
and off times by editing the time in the software.
delay(1000);
// here we are asking Arduino to wait for 1000ms before executing the next instruction.
Now, try to change the delay times, for both on and off times, and upload the code again.
What did you notice?
5. Repeat steps 4 and 5 for all the digital pins from 0-11

Ref: adafruit.com

Report:

Write a report that summarizes this experiment. Your report brief must include:
a) Cover sheet.
b) Objective - a short paragraph stating what the experiment is about.
c) Procedure - a description of the process of conducting the experiment. It should not be a
step-by-step account, but rather an overview of what was done.
d) Discussion - a complete discussion of the results of the experiment and the principals
involved. Include the outputs and also the screen captures as needed to support the
statements made in this section. Relegate extensive lists of raw data and detailed
computations to an appendix as appropriate.
e) Conclusion - a summary of what you have learned from the experiment.
f) Appendix - original raw data (initialed by the lab instructor) and details not placed in the
discussion section

You might also like