Skip to main content

Project - 11 :- 7 Segment Display By Using Arduino


                               PROJECT – 7 Segment Display

In this tutorial you will learn how to use 7 Segment with Arduino and making a count from 0 to 9.

                                                   STEP – 1 Components

Components Required:-
1.    Arduino Uno
2.    Breadboard
3.    7 Segment
4.    Wires.
5.    Resistance.
6.    Slide Button.

                                       STEP – 2: Circuit

The connections are pretty easy, see the image above with the breadboard circuit  schematic.

                                        STEP – 3 : Code

int a = 7;
int b = 6;
int c = 4;
int d = 3;
int e = 2;
int f = 8;
int g = 9;
int dp = 5;
int Button = 10;
int num = 0;

void setup()
{
  pinMode(a, OUTPUT);
  pinMode(b, OUTPUT);
  pinMode(c, OUTPUT);
  pinMode(d, OUTPUT);
  pinMode(e, OUTPUT);
  pinMode(f, OUTPUT);
  pinMode(g, OUTPUT);
  pinMode(dp, OUTPUT);
  pinMode(Button,INPUT);
}

void loop()
{
  if (num == 0) {
    digitalWrite(a, LOW);
    digitalWrite(b, LOW);
    digitalWrite(c, LOW);
    digitalWrite(d, LOW);
    digitalWrite(e, LOW);
    digitalWrite(f, LOW);
    digitalWrite(g, HIGH);
    digitalWrite(dp, HIGH);
  } else if (num == 1) {
    digitalWrite(a, HIGH);
    digitalWrite(b, LOW);
    digitalWrite(c, LOW);
    digitalWrite(d, HIGH);
    digitalWrite(e, HIGH);
    digitalWrite(f, HIGH);
    digitalWrite(g, HIGH);
    digitalWrite(dp, HIGH);
  } else if (num == 2) {
    digitalWrite(a, LOW);
    digitalWrite(b, LOW);
    digitalWrite(c, HIGH);
    digitalWrite(d, LOW);
    digitalWrite(e, LOW);
    digitalWrite(f, HIGH);
    digitalWrite(g, LOW);
    digitalWrite(dp, HIGH);
  } else if (num == 3) {
    digitalWrite(a, LOW);
    digitalWrite(b, LOW);
    digitalWrite(c, LOW);
    digitalWrite(d, LOW);
    digitalWrite(e, HIGH);
    digitalWrite(f, HIGH);
    digitalWrite(g, LOW);
    digitalWrite(dp, HIGH);
  } else if (num == 4) {
    digitalWrite(a, HIGH);
    digitalWrite(b, LOW);
    digitalWrite(c, LOW);
    digitalWrite(d, HIGH);
    digitalWrite(e, HIGH);
    digitalWrite(f, LOW);
    digitalWrite(g, LOW);
    digitalWrite(dp, HIGH);
  } else if (num == 5) {
    digitalWrite(a, LOW);
    digitalWrite(b, HIGH);
    digitalWrite(c, LOW);
    digitalWrite(d, LOW);
    digitalWrite(e, HIGH);
    digitalWrite(f, LOW);
    digitalWrite(g, LOW);
    digitalWrite(dp, HIGH);
  } else if (num == 6) {
    digitalWrite(a, LOW);
    digitalWrite(b, HIGH);
    digitalWrite(c, LOW);
    digitalWrite(d, LOW);
    digitalWrite(e, LOW);
    digitalWrite(f, LOW);
    digitalWrite(g, LOW);
    digitalWrite(dp, HIGH);
  } else if (num == 7) {
    digitalWrite(a, LOW);
    digitalWrite(b, LOW);
    digitalWrite(c, LOW);
    digitalWrite(d, HIGH);
    digitalWrite(e, HIGH);
    digitalWrite(f, HIGH);
    digitalWrite(g, HIGH);
    digitalWrite(dp, HIGH);
  } else if (num == 8) {
    digitalWrite(a, LOW);
    digitalWrite(b, LOW);
    digitalWrite(d, LOW);
    digitalWrite(e, LOW);
    digitalWrite(f, LOW);
    digitalWrite(g, LOW);
    digitalWrite(dp, HIGH);
  } else if (num == 9) {
    digitalWrite(a, LOW);
    digitalWrite(b, LOW);
    digitalWrite(c, LOW);
    digitalWrite(d, LOW);
    digitalWrite(e, HIGH);
    digitalWrite(f, LOW);
    digitalWrite(g, LOW);
    digitalWrite(dp, HIGH);
  }
 
  if (digitalRead(Button) == HIGH) {
    num++;
    num = num % 10;
    delay(500);
  }
 
} }

       /* Copy above Code and Paste in Your Arduino Sketch */

    Step 4: Well Done!

You have successfully completed one more Arduino Project and you learned how to use a 7 Segment Display with Arduino.

                  THANKYOU!


Next Project - 12 :- LCD Display By Using Arduino.
Previous Project - 10 :- KeyPad By Using Arduino

Comments

Popular posts from this blog

Project - 14 :- Traffic Light Using By Arduino

                                PROJECT – Traffic Light                        In this tutorial you will learn how to make Traffic Light with Arduino.                                                     STEP – 1 Components Components Required:- 1.     Arduino Uno 2.     Breadboard 3.     3  LED 4.     7 Segment 5.     3x 220Ohm resistors,1 1KOhm Wires .                                    ...

Project - 13 :- LED MATRIX By Using Arduino

                                PROJECT – LED MATRIX In this tutorial you will learn how to use LCD with Arduino and display some text on the LCD.                                                     STEP – 1 Components Components Required:- 1.      Arduino Uno 2.      Breadboard 3.      LED MATRIX 4.      Wires.                                          STEP – 2: Circuit The connections are pretty easy, see the image above with the b...

Project - 7 :- Clap Switch By Using Arduino

                                    PROJECT – CLAP SWITCH In this tutorial you will learn how to use a Sound Sensor with Arduino and glowing a LED and beeping a Buzzer by Clapping.                                                       STEP – 1: Components Components Required:- 1.     Arduino Uno. 2.     Breadboard. 3.     Sound Sensor. 4.     LED 5.     Buzzer 6.     Wires                   ...