Course Code: EEE 444
Course Title: Integrated Design Project II
Experiment No.: 01
Experiment Title: Arduino-controlled LED Blinking and Fading Operations
Student Name : Md Shakil Ahmed
Student ID : 213001007
Section : 213_D2
Date of Assignment : 14-02-2025
Date of Submission : 21-02-2025
Submitted to: Md. Istiac Ahmed, Lecturer, Green University of Bangladesh
To be Filled by the Teacher. Don’t Write Anything Here!
Received Date:
Late Submission:
Obtained Mark:
Date of Return:
Remarks:
Signature:
Department of Electrical and Electronic Engineering
Green University of Bangladesh
Lab Tasks
Circuit Diagram:.
Following is the circuit setup for an LED-chaser circuit using Arduino. The number of LEDs and Resistors
is five.LED is connected to the digital pin 2,3,4,5,6 of the Arduino Uno via a resistor of 1 kΩ. This resistor
acts as a current-limiting resistor here.
Figure 1 LED-chaser circuit
Arduino Code :
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
}
void loop() {
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
delay(1000);
Page 2 of 11
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
delay(1000);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
delay(1000);
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
delay(1000);
digitalWrite(6, LOW);
delay(1000);
}
3|Page
Task 01
Circuit Diagram:
Following is the circuit setup for an LED-blinking circuit using Arduino. The number of LEDs and
Resistors is five.LED is connected to the digital pin 2,3,4,5,6 of the Arduino Uno via a resistor of 1 kΩ.
This resistor acts as a current-limiting resistor here.
Figure 2 LED blinking circuit
Arduino Code :
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
}
void loop() {
int delayTime = 200;
bool increasing = true;
digitalWrite(2, HIGH);
Page 4 of 11
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
delay(delayTime);
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
delay(delayTime);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
delay(delayTime);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
delay(delayTime);
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
delay(delayTime);
digitalWrite(6, LOW);
delay(delayTime);
if (increasing) {
delayTime += 200;
if (delayTime >= 2000) {
increasing = false;
}
} else {
delayTime -= 200;
if (delayTime <= 200) {
increasing = true;
}
}
}
5|Page
Task 02
Circuit Diagram :
Following is the circuit setup for an LED-blinking circuit using Arduino. The number of four LEDs and
Resistors connected is sequentially.LED is connected to the digital pin 2,3,4,5 of the Arduino Uno via a
resistor of 1 kΩ. This resistor acts as a current-limiting resistor here.
Figure 3 LED blinking circuit
Arduino Code :
void setup() {
pinMode(2, OUTPUT); // Red LED
pinMode(3, OUTPUT); // Green LED
pinMode(4, OUTPUT); // Blue LED
pinMode(5, OUTPUT); // Yellow LED
}
void loop() {
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
Page 6 of 11
delay(1000);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
delay(1000);
digitalWrite(5, LOW);
delay(1000);
}
7|Page
Task 03
Circuit Diagram :
Following is the circuit setup for an LED-fading and blinking circuit using Arduino. The number of four
LEDs and Resistors connected is sequentially.Fast two LED fading(Red,Green) and Next two LED blinking
(Blue,Yellow).LED is connected to the digital pin 2,3,4,5 of the Arduino Uno via a resistor of 1 kΩ. This
resistor acts as a current-limiting resistor here.
Figure 4 LED fading and blinking circuit
Arduino Code :
void setup() {
pinMode(2, OUTPUT); // Red LED (Fading)
pinMode(3, OUTPUT); // Green LED (Fading)
pinMode(4, OUTPUT); // Blue LED (Blinking)
pinMode(5, OUTPUT); // Yellow LED (Blinking)
}
void loop() {
// Fade in Red and Green LEDs
for (int brightness = 0; brightness <= 255; brightness++) {
analogWrite(2, brightness);
analogWrite(3, brightness);
delay(10);
}
Page 8 of 11
// Fade out Red and Green LEDs
for (int brightness = 255; brightness >= 0; brightness--) {
analogWrite(2, brightness);
analogWrite(3, brightness);
delay(10);
}
// Blink Blue and Yellow LEDs
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
delay(500);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(500);
}
9|Page
Report Questions and Discussion
Q1. What is the purpose of the digital pins on an Arduino board, and how are they typically labeled?
Answer:
For sending or receiving ON or OFF signals. Currently supporting devices D0 through D13. Modern
devices seem to support PWM.
Q2. Are there any limitations or constraints to keep in mind when using analogRead() on an Arduino board?
Answer:
It measures between 0 to 5 V (and 3.3 V on many boards) and returns values between 0 and 1023, which
represents a resolution of 10 bits. Reading speed is slower and may cause a conflict with digital pins.
Q3. What is the function of the pinMode() function in Arduino, and why is it important when working with
digital pins?
Answer:
A pin is designated as input or output to prevent any possible errors from occurring. Member prevents
malfunction and safeguard different components.
Q4. What is the maximum and minimum voltage range for both digital and analog pins on most Arduino
boards?
Answer:
The ranges for digital and analog pins are the following: Digital pins: 0V (LOW) to 5V (HIGH). Analog
pins: 0V to 5V (or 3.3V on some boards).
Page 10 of 11
Q5. What is the difference between digital pins and analog pins on an Arduino board?
Answer:
Feature Digital Pins Analog Pins
Continuous (0-5V or 0-
Signal Type Discrete (HIGH/LOW)
3.3V)
Read variable voltage
Functions Read/write digital states
levels
Sensors (e.g.,
Usage LEDs, buttons, sensors
temperature, light)
PWM Support Some (marked ~) No PWM capability
Reading Method digitalRead()/digitalWrite() analogRead()
Discussion :
This Experiment 1 is Arduino-controlled LED Blinking and Fading Operations. I am fading and blinking
how LEDs work with Arduino. one erudite that. And our sir discusses the code of this experiment in a
extremely nice way.
11 | P a g e