0% found this document useful (0 votes)
11 views

Assignment 1

Uploaded by

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

Assignment 1

Uploaded by

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

IoT Enabled Prototyping for Engineers (22IEP308)

Assignment 1

Topic:
Name Shivaji M Pujar

USN 4SO23CS212

Class CSE/C

Marks Awarded:

Faculty Signature and date:


IoT Enabled Prototyping for Engineers
Assignment 1
Topic: Write a Program for One Digit 7-Segment LED Display
using Arduino

Total marks: 20
CO mapped: 22IEP308.2 PIs mapped: 2.1.1, 2.1.2, 2.1.3, 5.1.1, 5.1.2, 5.2.1, 5.3.1 Last
Date: 11 October 2024

AIM: The aim is to demonstrate how to use an Arduino to control a one-digit 7-segment
LED display, enabling it to sequentially show the digits 0-9. This project will enhance
understanding of digital electronics, circuit connections, and basic programming skills while
providing hands-on experience with microcontrollers and display components.

THEORY: A 7-segment display is a device used to show numbers and some letters. It
consists of seven LED segments arranged in a figure-eight shape. These segments are
labeled a through g and can light up in different combinations to represent digits
from 0 to 9.

Types

● Common Cathode: All negative (cathode) connections are linked to ground;


segments light up with a positive voltage.
● Common Anode: All positive (anode) connections are linked to power;
segments light up with a ground connection.

Working

To display a number, the Arduino sends signals to the corresponding segments:

● For example, to show "3," segments a, b, c, d, and g are turned on.

Applications

7-segment displays are commonly found in clocks, calculators, and digital meters.
Controlling them with an Arduino helps you learn about electronics and
programming basics.

PROGRAM: const int a = 2;

const int b = 3;

const int c = 4;

const int d = 5;

const int e = 6;
const int f = 7;

const int g = 8;

const int digitSegments[10][7] = {

{1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 0, 0, 0, 0},

{1, 1, 0, 1, 1, 0, 1},

{1, 1, 1, 1, 0, 0, 1},

{0, 1, 1, 0, 0, 1, 1},

{1, 0, 1, 1, 0, 1, 1},

{1, 0, 1, 1, 1, 1, 1},
{1, 1, 1, 0, 0, 0, 0},

{1, 1, 1, 1, 1, 1, 1},

{1, 1, 1, 1, 0, 1, 1}

};

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

pinMode(b, OUTPUT);

pinMode(c, OUTPUT);

pinMode(d, OUTPUT);

pinMode(e, OUTPUT);
pinMode(f, OUTPUT);

pinMode(g, OUTPUT);

void loop() {
for (int i = 0; i < 10; i++) {

displayDigit(i);

delay(1000);

}
void displayDigit(int digit) {

digitalWrite(a, digitSegments[digit][0]);

digitalWrite(b, digitSegments[digit][1]);

digitalWrite(c, digitSegments[digit][2]);

digitalWrite(d, digitSegments[digit][3]);
digitalWrite(e, digitSegments[digit][4]);

digitalWrite(f, digitSegments[digit][5]);

digitalWrite(g, digitSegments[digit][6]);

}
RESULTS/CONCLUSION: In this project, we explored how to control a
one-digit
7-segment LED display using an Arduino. By understanding the basic wiring,
segment control, and programming logic, we successfully displayed numbers 0-9.
This hands-on experience not only reinforced fundamental concepts in electronics
and programming but also provided a foundation for more complex projects
involving displays and microcontrollers. Mastering the use of 7-segment displays
opens up opportunities for creating various electronic devices and enhancing
interactive projects.

You might also like