7 Segment CC
7 Segment CC
1 × Breadboard
1 × Arduino Uno R3
1 × 7-Segment Display CC
220 to 1000Ω Resistor
Jumper wire
Seven Segment Display is an LED based display screen that can display information in
the form of decimal numbers. The seven segment display is a used in place of the more
complex dot matrix displays. It is called so because it consists of seven segments of light
emitting diodes (LEDs) that are assembled like decimal 8 as shown in the following
figure.
Seven segments LED display can be used in applications where an electronic display
device is required for showing decimal numbers from 0 to 9, sometimes, basic characters
as well. Since, it uses LEDs, therefore it is an energy efficient display device. Therefore, it
is most widely used in those devices that are powered by a small battery or a cell.
Working of Seven Segment LED Display
A seven segment display consists of seven LED segments arranged like a decimal 8.
These LED segments are illuminated to form a pattern that represents a decimal number
from 0 to 9. Now, let us understand, how the seven segment LED display work to display
different numbers.
When power is given to all the segments and if we disconnect power from the
segment ‘g’, then it displays the decimal number 0.
When the power is given to segments "b" and "c" only, then it displays the number
1.
When the power is given to the segments "a", "b", "g", "e", "d", then it displays the
number 2.
When the power is given to segments "a", "b", "g", "c", "d", then it displays the
number 3.
When the power is given to segments "b", "c", "f", "g", then it displays the number
4.
When the power is given to segments "a", "c", "d", "f", "g", then it displays the
number 5.
When the power is given to segments "a", "c", "d", "e", "f", "g", then it displays the
number 6.
When the power is given to segments "a", "b", "c", then it displays the number 7.
When electrical energy is supplied to all the segments, then the seven segment LED
display shows the decimal number 8.
When the power is given to segments "a", "b", "c", "d", "f", "g", then it displays the
number 9.
In this way, we can display any decimal number from 0 to 9 by illuminating a set of LED
segments of the seven segment LED display.
void
display2(void) // display number 2
{
digitalWrite(a,HIGH);
digitalWrite(b,HIGH);
digitalWrite(g,HIGH);
digitalWrite(e,HIGH);
digitalWrite(d,HIGH);
}
void display3(void) // display number3
{
digitalWrite(a,HIGH);
digitalWrite(b,HIGH);
digitalWrite(c,HIGH);
digitalWrite(d,HIGH);
digitalWrite(g,HIGH);
}
void display4(void) // display number4
{
digitalWrite(f,HIGH);
digitalWrite(b,HIGH);
digitalWrite(g,HIGH);
digitalWrite(c,HIGH);
}
void display5(void) // display number 5
{
digitalWrite(a,HIGH);
digitalWrite(f,HIGH);
digitalWrite(g,HIGH);
digitalWrite(c,HIGH);
digitalWrite(d,HIGH);
}
void setup()
{
int i;
for(i=4;i<=11;i++)
pinMode(i,OUTPUT);
}
void loop()
{
while(1)
{
clearDisplay();
display0();
delay(2000);
clearDisplay();
display1();
delay(2000);
clearDisplay();
display2();
delay(2000);
clearDisplay();
display3();
delay(2000);
clearDisplay();
display4();
delay(2000);
clearDisplay();
display5();
delay(2000);
clearDisplay();
display6();
delay(2000);
clearDisplay();
display7();
delay(2000);
clearDisplay();
display8();
delay(2000);
clearDisplay();
display9();
delay(2000);
}
}