7 Segment Led Display Application
7 Segment Led Display Application

7 Segment Led Display Application

AliExpress WW
AliExpress WW

In this application, we will experiment with a 7 segment led display and counter.

7 Segment display is a common cathode display. We will light the LEDs of the screen using the digital pins of the Arduino board.

7 segment display has 10 pins. These are: a, b, c, d, e, f, g, point and two Cathode (GND) tips.

a, b, c, d, e, f, g, point pins are connected to the digital output pins of the Arduino board with 1K resistors. The dot pins a, b, c, d, e, f, g, are connected to the digital outputs of the board d13, d12, d11, d10, d9, d8, d7, d6, d4.

In the Arduino code screen, we defined a sequence for each digit and specified which leds to light. In the codes below, we exported the values in this array with the "digitalWrite" command with the help of a "for" loop.

Arduino Codes:

//--------- -{a,b,c,d,e,f,g,dot}
  int s0[] = {1,1,1,1,1,1,0,0};
  int s1[] = {0,1,1,0,0,0,0,0};
  int s2[] = {1,1,0,1,1,0,1,0};
  int s3[] = {1,1,1,1,0,0,1,0};
  int s4[] = {0,1,0,0,1,1,1,0};
  int s5[] = {1,0,1,1,0,1,1,0};
  int s6[] = {1,0,1,1,1,1,1,0};
  int s7[] = {1,1,1,0,0,0,0,0};
  int s8[] = {1,1,1,1,1,1,1,0};
  int s9[] = {1,1,1,1,0,1,1,0};
  int s10[]= {1,1,1,1,1,1,0,0};
  
void setup()
{
  
  pinMode(13, OUTPUT);  // a 
  pinMode(12, OUTPUT);  // b 
  pinMode(11, OUTPUT);  // c 
  pinMode(10, OUTPUT);  // d 
  pinMode(9, OUTPUT);    // e 
  pinMode(8, OUTPUT);  // f
  pinMode(7, OUTPUT);  // g 
  pinMode(6, OUTPUT);  //DOT LED  <-----------
  
 }
void loop()
{
  // test routing-----------------------
  for(int i=6;i<14;i++)  {
    digitalWrite(i,HIGH); delay(50);digitalWrite(i,LOW);
    }
    for(int i=14;i>5;i--)  {
    digitalWrite(i,HIGH); delay(50);digitalWrite(i,LOW);
    }
// test routing-----------------------END

for(int i=1;i<10;i++) { digitalWrite(14-i,s0[i-1]); delay(50);digitalWrite(14-i,s0[i-1]);}; delay(100);
for(int i=1;i<10;i++) { digitalWrite(14-i,s1[i-1]); delay(50);digitalWrite(14-i,s1[i-1]);}  delay(100);
for(int i=1;i<10;i++) { digitalWrite(14-i,s2[i-1]); delay(50);digitalWrite(14-i,s2[i-1]);}    delay(100);
for(int i=1;i<10;i++) { digitalWrite(14-i,s3[i-1]); delay(50);digitalWrite(14-i,s3[i-1]);}; delay(100);
for(int i=1;i<10;i++) { digitalWrite(14-i,s4[i-1]); delay(50);digitalWrite(14-i,s4[i-1]);}  delay(100);
for(int i=1;i<10;i++) { digitalWrite(14-i,s5[i-1]); delay(50);digitalWrite(14-i,s5[i-1]);}    delay(100);
for(int i=1;i<10;i++) { digitalWrite(14-i,s6[i-1]); delay(50);digitalWrite(14-i,s6[i-1]);}; delay(100);
for(int i=1;i<10;i++) { digitalWrite(14-i,s7[i-1]); delay(50);digitalWrite(14-i,s7[i-1]);}  delay(100);
for(int i=1;i<10;i++) { digitalWrite(14-i,s8[i-1]); delay(50);digitalWrite(14-i,s8[i-1]);}    delay(100);
for(int i=1;i<10;i++) { digitalWrite(14-i,s9[i-1]); delay(50);digitalWrite(14-i,s9[i-1]);}; delay(100);

    
    
}

Youtube Channel: 

 

 

AliExpress WW