Assignment 1
Assignment 1
Assignment 1
Topic:
Name Shivaji M Pujar
USN 4SO23CS212
Class CSE/C
Marks Awarded:
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
Working
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.
const int b = 3;
const int c = 4;
const int d = 5;
const int e = 6;
const int f = 7;
const int g = 8;
{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.