Micro Lab 1
Micro Lab 1
Micro Lab 1
1
SETTING UP AND PROGRAMMING CONTROLLERS
Course Code: CPE 006 Program: ECE
Course Title: Microprocessor Systems Date Performed:11/18/2019
Section:EC42FA1 Date Submitted:11/25/2019
Name/s: Depone, James Alexander M. Nietes, Angela Instructor: Engr. Cris G. Hate
Elnar, Hem Lock Pantalunan, Cindy C.
Geronimo, Frederick
1. Objective:
This activity aims to demonstrate the concept of programming a microprocessor-based system.
Another aim of this activity is to introduce procedures in testing and identification of errors in a
program.
4. Resources Needed:
4.1 Desktop Computer
4.2 Arduino Software
4.3 LEDs
4.4 Breadboard
4.5 Digital Multimeters
4.6 Arduino
4.7 Connecting Wires
4.8 Resistors
5. Procedures:
3. In this activity, we are asked to light an LED with Arduino. For the source code, follow the
block diagram below.
4. After writing the source code, click the compile button from the toolbar to verify for any error
in the code.
5. Then, to upload your code to the Arduino click the upload button beside the compile button
in the toolbar.
6. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.
Figure 1.
4. After writing the source code, click the compile button from the toolbar to verify for any error
in the code.
5. Then, to upload your code to the Arduino click the upload button beside the compile button
in the toolbar.
6. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.
Figure 2.
Activity 3 – Running LED with Arduino
1. Connect the Arduino to the computer using USB cable type and look for the Arduino
software on your desktop.
2. Start writing your code in the Sketch Writing Area.
3. In this activity, we are asked to blink an LED with Arduino. For the source code, follow the
block diagram below.
4. After writing the source code, click the compile button from the toolbar to verify for any error
in the code.
5. Then, to upload your code to the Arduino click the upload button beside the compile button
in the toolbar.
6. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.
6. Results
Test Program :
void setup () {
pinMode (13, OUTPUT);
void loop () {
digitalWrite(13, HIGH);
Test Program:
void setup () {
pinMode (13, OUTPUT);
}
void loop () {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Test Program:
void setup () {
pinMode (13, OUTPUT);
pinMode (12, OUTPUT);
pinMode (11, OUTPUT);
pinMode (10, OUTPUT);
pinMode (9, OUTPUT);
pinMode (8, OUTPUT);
pinMode (7, OUTPUT);
pinMode (2, OUTPUT);
}
void loop () {
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
digitalWrite(2, LOW);
delay(500);
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
digitalWrite(2, HIGH);
delay(500);
}
Actual Connection
Circuit Diagram for running LEDs
TEST RESULTS
PIN NUMBER VOLTAGE (V) CURRENT (mA)
13 3.9 24
12 3.9 21
11 3.98 18.3
10 4.01 18.3
9 3.97 19.87
8 4.01 21.4
7 4.06 19.87
2 4.27 22.05
7. Observations:
In this experiment we use arduino uno to make running lights. we observed that to make the LED
blink it takes a few lines of code. The first thing we do is define a variable that will hold the number of the
pin that the LED is connected to, The second thing we need to do is configure as an output the pin
connected to the LED.Finally, we have to turn the LED on and off with the sketch's loop() function. We do
this with two calls to the digitalWrite() function, one with HIGH to turn the LED on and one with LOW to
turn the LED off. If we simply alternated calls to these two functions, the LED would turn on and off too
quickly for us to see, so we add two calls to delay() to slow things down. The delay function works with
milliseconds, so we pass it 100ms to pause for a second.
8. Conclusions:
In this activity, we learn how to make LED blink in arduino by uploading few codes. we therefore
conclude that the blinking LED is the first program we must learn in arduino because the blinking LED is
the "Hello World!" of pyhsical computing.
9. References:
https://makeradvisor.com/top-10-most-useful-arduino-shields/
https://en.wikipedia.org/wiki/Arduino_Uno#Background