Exercise No. 2 Blinking LED
Exercise No. 2 Blinking LED
Exercise No. 2 Blinking LED
Blinking LED
Objectives: Connecting and operating LED connected to the digital outputs of an Arduino.
Equipment needed:
2. An Arduino-compatible microcontroller.
3. Make sure you select the right board (see below screen-shot)
4. Then select the correct serial port. (see below screen-shot)
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.
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