0% found this document useful (0 votes)
4 views10 pages

Exp 1

This document is a lab report for the Integrated Design Project -2 course at Green University of Bangladesh, focusing on Arduino programming experiments. It includes various codes for LED operations such as blinking, fading, and chaser circuits, along with instructions for report submission. General guidelines for writing the report and a section for teacher feedback are also provided.

Uploaded by

221901026
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views10 pages

Exp 1

This document is a lab report for the Integrated Design Project -2 course at Green University of Bangladesh, focusing on Arduino programming experiments. It includes various codes for LED operations such as blinking, fading, and chaser circuits, along with instructions for report submission. General guidelines for writing the report and a section for teacher feedback are also provided.

Uploaded by

221901026
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Green University of Bangladesh (GUB)

Department of Electrical and Electronic Engineering [EEE]


Faculty of Sciences & Engineering
Semester: Summer Year: 2025, B.Sc. in EEE (Regular)

Lab Report
Course Name: Integrated Design Project -2
Course Code: EEE-444 Section: 221pc_D1 Batch: 221

Experiment No. : 01
Experiment Name :

Student Details

Name ID

Date of Performance:
Date of Submission:
Course Teachers Name & Designation:
General Instructions:
(i) Don’t write anything behind the cover page.
(ii) Don’t copy your Laboratory reports from anyone.
(iii) Check deadlines before submission.
(iv) Handwriting should be legible. Avoid spelling mistakes & grammatical errors in the laboratory report.
(v) Incomplete submission of the Laboratory report will not be accepted.

[For Teachers use only: Don’t Write Anything inside this box]

Lab Report status


Marks: ………………………………………….. Signature:
…………………………….
Comments: ……………………………………. Date:

Arduino Code:
(a) Code for LED blinking

int ledpin=11;

void setup() {
pinMode(ledpin,OUTPUT);

void loop() {
digitalWrite(ledpin,HIGH);
delay(1000);
digitalWrite(ledpin,LOW);
delay(1000);
}

Output:

Screenshot of PC Display +Taken Photos of Experiment Output + All found output


from the experiment. Must contain a figure caption

(b) Code for LED fading without a potentiometer


int led=13;
int b=0; // b=brightness
int f=5; // f=fadeamoun

void setup() {
pinMode(led,OUTPUT);
// put your setup code here, to run once:

}
void loop(){
analogWrite(led,b);
b=b+f;
if(b<=0 || b>=255)
{f=-f;}
delay(50);
}

Output:

(c) Code for LED fading using potentiometer


int pot=A0;
int potvalue=0;
int ledvalue=0;
int led=13;

void setup() {

pinMode(led,OUTPUT);
}

void loop() {
potvalue=analogRead(pot);
ledvalue=map(potvalue,0,1023,0,255);
analogWrite(led,ledvalue);
delay(10);

Output:

LAB TASK :
Arduino Code:

Write code for an LED-chaser circuit. The number of LEDs is five.

int leds[] = {2, 3, 4, 5, 6}; // LED pins

void setup() {
for (int i = 0; i < 5; i++) {
pinMode(leds[i], OUTPUT); // Set LED pins as output
}
}

void loop() {
for (int i = 0; i < 5; i++) {
digitalWrite(leds[i], HIGH); // Turn on LED
delay(200); // Wait
digitalWrite(leds[i], LOW); // Turn off LED
}
}

Output:

Report Task:

Arduino code:
1. Write a program to blink an LED with variable delay. The delay will increase from 200 ms to
2000 ms with an increment of 200 ms. Afterwards, the delay will decrease

void setup() {
pinMode(led, OUTPUT);
}

void loop() {
for (int t = 200; t <= 2000; t += 200) {
digitalWrite(led, HIGH); delay(t);
digitalWrite(led, LOW); delay(t);
}

for (int t = 1800; t >= 200; t -= 200) {


digitalWrite(led, HIGH); delay(t);
digitalWrite(led, LOW); delay(t);
}
}

Output:

2. Write a program to blink four LEDs (Red, Green, Blue, and Yellow) sequentially.

int red=13;
int green=12;
int yellow=11;
int blue=10;
void setup() {
// put your setup code here, to run once:
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(yellow,OUTPUT);
pinMode(blue,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(red,HIGH);
delay(400);
digitalWrite(green,HIGH);
delay(600);
digitalWrite(yellow,HIGH);
delay(800);
digitalWrite(blue,HIGH);
delay(1000);

digitalWrite(red,LOW);
delay(400);
digitalWrite(green,LOW);
delay(600);
digitalWrite(yellow,LOW);
delay(800);
digitalWrite(blue,LOW);
delay(1000);
}

Output:
3. Write a program to blink four LEDs (Red, Green, Blue, and Yellow). Among these,
the Red and Green LEDs will fade in and fade out while the other LEDs will blink
instantaneously.

int led1 = 11;


int led2 = 10;
int led3 = 6;
int led4 = 2;
int b = 0;
int f = 5;

void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
}

void loop() {
analogWrite(led1, b);
b = b + f;
if (b <= 0 || b >= 255) {
f = -f;
}

delay(100);
analogWrite(led2, b);
b = b + f;

if (b <= 0 || b >= 255) {


f = -f;
}

delay(100);
digitalWrite(led3, HIGH);
delay(100);
digitalWrite(led4, HIGH);
delay(100);
digitalWrite(led3, LOW);
delay(100);
digitalWrite(led4, LOW);
delay(100);
}

Output:

You might also like