You are on page 1of 17

Activity Number: ACTIVITY 1.

2 Title: Arduino Basics


Course Code: CPE 006 Course Title: Microprocessor Systems
Date Performed: Date Submitted:
Section: EE32S1
May 14, 2021 May 14, 2021
Student Name: Nagum, Carl Joseph, B. Instructor: Engr. Arriane D. Cabreros

“I affirm that I have not given or received unauthorized help on this activity and that this work my own”
I. OBJECTIVES
→To make the on-board LED of the Arduino board or an external LED blink.
→To Apply serial communication between the Arduino and the student’s computer via USB connection.
→To read analog data from the physical world.
→To use pulse width modulation (PWM) to vary voltage input within a circuit.
→To create and upload a program to microcontroller using the C programming language.
→Control electronic components using a microcontroller.
II. RESULTS AND SCREENSHOTS OF OUTPUTS
A.) Blinking a Light Emitting Diode
CODE:

OUTPUT:
B.) Applying Pulse Width Modulation
CODE:

OUTPUT:
C.) Digital Serial Communication
CODE:

OUTPUT:
D.) Reading Analog Data
CODE:

OUTPUT:
E.) Reading Analog Data to Serial Communication
CODE:

OUTPUT:
F.) Blinking LED’s
CODE:

OUTPUT:
G.) Additional Activity 1 (Variation of delay in Blinking LED)
CODE:

OUTPUT:
H.) Additional Exercise 2 (case switching)
CODE:

OUTPUT:
I.) Additional Exercise 3
CODE:

OUTPUT:
J.) LED Control using FOR Loops
CODE:

OUTPUT:

III. OBSERVATIONS FOR EACH RESULT


A.) Observation for Blinking a Light Emitting Diode
In this simulation, I observed that the code plays a critical role because the input commands are the one that dictates
the output of the Light Emitting Diode. The blinking of light occurs due to the command in the loop wherein the digitalWrite for
LED is happening repeatedly with high and low output in a delay time of 1000 milliseconds. I also noticed the blinking of LED
can be faster and slower depending on the delay time.
B.) Observation for Applying Pulse Width Modulation
In this simulation, I observed that the LED’s brightness is varying. I noticed that the code analogWrite is used to vary
the brightness of the LED with a corresponding delay time. I also noticed that the output is the same even if the input from the
Arduino Uno R3 is from pin 3,5,6,9,10, and 11 because those pins are labeled with pulse width modulation (PWD).
C.) Observation for Digital Serial Communication
In this simulation, I observed that the binary output in the serial monitor is changing from LOW (zero) to HIGH (1)
when the push button is pressed the once the push button is released the binary output from the serial monitor will display
LOW (zero) values again. I noticed that the digitalRead command in the code is the one that interprets the input of the push
button that causes the binary output in the serial monitor to change.
D.) Observation for Reading Analog Data
In this simulation, I observed that the maximum value displayed in the serial monitor using 10K potentiometer is 1023
and the minimum value is 0. I noticed that the value in the serial monitor changes when the potentiometer is being adjusted.
It is because of the command analogRead in the code which is used to read the value of a specified analog pin. Lastly, I
noticed that the analogRead command only works when the input is connected to the analog pins of the Arduino Uno R3.
E.) Observation for Reading Analog Data to Serial Communication
In this simulation, I observed that the output in the serial monitor is also varying same with my observation for reading
analog data, the difference is the range of values displayed in the serial monitor because in this setup the values only range
from 0.00 to 5.00 since the analogRead is multiplied to 5.0 and divided by 1023. I noticed that the command float is used that
allows the value to be displayed in the serial monitor with two decimal places.
F.) Observation for Blinking LED’s
In this simulation, I observed the three LEDs are blinking synchronously with a delay time of 1000 milliseconds. I
noticed that the command used is similar with the command used in Blinking single LED of the setup A. The digitalWrite
command is used for setting the OUTPUT of the 3 LEDs. As also noticed in the previous observations the blinking of LEDs
can be varied depending on the delay time stated in the code.
G.) Observation for Additional Activity 1 (Variation of delay in Blinking LED)
In this simulation, I observed that the speed of the blinking LED can be varied by pressing the push button. I noticed
that the command uses the digitalWrite command to set the output of the LED and delay time is set with an increment of 100.
Lastly, I observed that the maximum delay time is up to 100o milliseconds because of the if command in the code wherein
once the delay time reaches to 1000 milliseconds, it will automatically reset to the set 100 milliseconds delay time.
H.) Observation for Additional Exercise 2 (case switching)
In this simulation, I observed that the LED light will only turn on once their case is called in the serial monitor. Once
case a, b, c, d, and e are called, the LED will be on and the serial monitor will display that the 1st, 2nd, 3rd, 4th, and 5th LED is
on. However, when the variable being called is not in the parameter of the 5 cases the LEDs will automatically turn off and
the serial monitor will display LEDs are off.
I.) Observation for Additional Exercise 3
In this simulation, I observed that the LED changes its output from high to low when the push button is press. I also
noticed that the millis () command is used in the code which I think the factor that causes the LED to turn off when the push
button is being press. While coding, I noticed that the grouping of curly braces is very important because it is used for the
separation of statement blocks to ensure that the code would not encounter an error during the simulation process.
J.) Observation for LED Control using FOR Loops
In this simulation, the LEDs are blinking but not synchronously unlike the setup F, I noticed that in this setup the for
command is used to insert the parameter of having 3 LEDs and to set that the blinking of LEDs will happened at the increment
set in the code which is “for (int i = 0; i < 3; i++)”. The code means that the 1st LED will be high and low at every 100 milliseconds
then 2nd LED will operate the same after the 1st LED completed a single loop, and the same applies to the 3rd LED.
IV. CONCLUSION
Based from the different simulation process done using Arduino Uno R3, I can conclude that the Arduino can operate
in a flexible manner using the C programming language. As shown in different setups above the Arduino can both perform
the analog and digital signal because based from its schematic diagram it has 6 analog pins located at the lower left and 13
digital input/output pins located at the upper part. Flexibility and efficiency wise, Arduino satisfies both of the category. The
flexibility of Arduino allows its wide application in different sectors such as in smart homes, traffic signal control, sensors, and
security purposes. For instance, the motion sensor can be installed through windows and doors for security purposes at night
wherein the sensor can detect and produce a sound when the doors and windows make a motion. To sum up all the things
that was performed in this activity, Arduino boards are physical programmable boards that can be used in real-world
applications for flexible programming, customizable signal types, and fast adaptation to existing installations.

V. SIMULATION LINK OF TINKERCAD

A.) Blinking a Light Emitting Diode:


https://www.tinkercad.com/things/eyfPyxUj0kY-blinking-light-emitting-diode/editel
B.) Applying Pulse Width Modulation:
https://www.tinkercad.com/things/cNkejLGgnsK-applying-pulse-width-modulation/editel
C.) Digital Serial Communication:
https://www.tinkercad.com/things/lzqDebIc3zp-digital-serial-communication/editel
D.) Reading Analog Data:
https://www.tinkercad.com/things/gc6zRVNojRl-reading-analog-data/editel
E.) Reading Analog Data to Serial Communication:
https://www.tinkercad.com/things/4dYmWrCzmz1-reading-analog-data-to-serial-communication/editel
F.) Blinking LED’s:
https://www.tinkercad.com/things/kYTumTJuxI0-blinking-led/editel
G.) Additional Activity 1 (Variation of delay in Blinking LED):
https://www.tinkercad.com/things/ak3hjkVWgEO-additionalactivity12/editel
H.) Additional Exercise 2 (case switching):
https://www.tinkercad.com/things/fjpBlQMO837-additionalexercise2/editel
I.) Additional Exercise 3:
https://www.tinkercad.com/things/6mfMYF1ap8W-additionalexercise3/editel
J.) LED Control using FOR Loops:
https://www.tinkercad.com/things/4IVQQDpzZEI-led-control-using-for-loops/editel

You might also like