Working with 7-Segment Display

Working with 7-Segment Display © GPL3+

This project demonstrates the working of a 7-segment display with Arduino.

  • 250 views
  • 0 comments
  • 5 respects

Components and supplies

Apps and online services

About this project

This project demonstrates working with a 7-segment display and Arduino.

Click here to learn about 7 Segment Display

Objective

Count 0 to 9 at an interval of 1 second.

Working with Seven Segment Display

Code

Seven Segment DisplayArduino
Counts 0 to 9
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 DP = 9;

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);
}

void loop()
{
  zero();
  delay (1000);
  one();
  delay (1000);
  two();
  delay (1000);
  three();
  delay (1000);
  four();
  delay (1000);
  five();
  delay (1000);
  six();
  delay (1000);
  seven();
  delay (1000);
  eight();
  delay (1000);
  nine();
  delay (1000);
}

void zero()
{
  digitalWrite (A, LOW);
  digitalWrite (B, LOW);
  digitalWrite (C, LOW);
  digitalWrite (D, LOW);
  digitalWrite (E, LOW);
  digitalWrite (F, LOW);
  digitalWrite (G, HIGH);
  digitalWrite (DP, HIGH);
}

void one()
{
  digitalWrite (A, HIGH);
  digitalWrite (B, LOW);
  digitalWrite (C, LOW);
  digitalWrite (D, HIGH);
  digitalWrite (E, HIGH);
  digitalWrite (F, HIGH);
  digitalWrite (G, HIGH);
  digitalWrite (DP, HIGH);
}

void two()
{
  digitalWrite (A, LOW);
  digitalWrite (B, LOW);
  digitalWrite (C, HIGH);
  digitalWrite (D, LOW);
  digitalWrite (E, LOW);
  digitalWrite (F, HIGH);
  digitalWrite (G, LOW);
  digitalWrite (DP, HIGH);
}

void three()
{
  digitalWrite (A, LOW);
  digitalWrite (B, LOW);
  digitalWrite (C, LOW);
  digitalWrite (D, LOW);
  digitalWrite (E, HIGH);
  digitalWrite (F, HIGH);
  digitalWrite (G, LOW);
  digitalWrite (DP, HIGH);
}

void four()
{
  digitalWrite (A, HIGH);
  digitalWrite (B, LOW);
  digitalWrite (C, LOW);
  digitalWrite (D, HIGH);
  digitalWrite (E, HIGH);
  digitalWrite (F, LOW);
  digitalWrite (G, LOW);
  digitalWrite (DP, HIGH);
}

void five()
{
  digitalWrite (A, LOW);
  digitalWrite (B, HIGH);
  digitalWrite (C, LOW);
  digitalWrite (D, LOW);
  digitalWrite (E, HIGH);
  digitalWrite (F, LOW);
  digitalWrite (G, LOW);
  digitalWrite (DP, HIGH);
}

void six()
{
  digitalWrite (A, LOW);
  digitalWrite (B, HIGH);
  digitalWrite (C, LOW);
  digitalWrite (D, LOW);
  digitalWrite (E, LOW);
  digitalWrite (F, LOW);
  digitalWrite (G, LOW);
  digitalWrite (DP, HIGH);
}

void seven()
{
  digitalWrite (A, LOW);
  digitalWrite (B, LOW);
  digitalWrite (C, LOW);
  digitalWrite (D, HIGH);
  digitalWrite (E, HIGH);
  digitalWrite (F, HIGH);
  digitalWrite (G, HIGH);
  digitalWrite (DP, HIGH);
}

void eight()
{
  digitalWrite (A, LOW);
  digitalWrite (B, LOW);
  digitalWrite (C, LOW);
  digitalWrite (D, LOW);
  digitalWrite (E, LOW);
  digitalWrite (F, LOW);
  digitalWrite (G, LOW);
  digitalWrite (DP, HIGH);
}

void nine()
{
  digitalWrite (A, LOW);
  digitalWrite (B, LOW);
  digitalWrite (C, LOW);
  digitalWrite (D, LOW);
  digitalWrite (E, HIGH);
  digitalWrite (F, LOW);
  digitalWrite (G, LOW);
  digitalWrite (DP, HIGH);
}

Schematics

Breadboard Diagram
Make Connection on the Breadboard as shown in the figure.
Breadboard diagram working with seven segment display rnzctwx7tf
Schematic Diagram
Schematic diagram working with seven segment display d4jxe6azpx

Comments

Similar projects you might like

Control a 7 Segment Display with a keypad!

Project tutorial by Isaac100

  • 12,387 views
  • 17 comments
  • 19 respects

GPS Location Display With GPS And TFT Display Shields

Project tutorial by Boian Mitov

  • 8,820 views
  • 5 comments
  • 23 respects

Snap Circuits® - Seven Segment Display

Project tutorial by Daniel Porrey

  • 2,437 views
  • 0 comments
  • 7 respects

Programming 4 Digit 7 Segment LED Display

by SAnwandter1

  • 102,101 views
  • 31 comments
  • 78 respects

Matrix Keypad With 7 Segment Display

by David A Riewe

  • 7,708 views
  • 1 comment
  • 8 respects
Add projectSign up / Login