Working with 7-Segment Display

Working with 7-Segment Display © GPL3+

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

  • 428 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

GPS Location Display With GPS And TFT Display Shields

Project tutorial by Boian Mitov

  • 15,607 views
  • 6 comments
  • 35 respects

Lightpipe 7-Segment Display

Project tutorial by Brian Lough

  • 7,361 views
  • 4 comments
  • 27 respects

Working with Shift Register

by SBR

  • 3,559 views
  • 2 comments
  • 8 respects

DIY 7-Segment Display

Project tutorial by Pop Gheorghe

  • 2,169 views
  • 2 comments
  • 2 respects

7-Segment + Integrated Circuit

Project showcase by goarray

  • 1,576 views
  • 0 comments
  • 6 respects
Add projectSign up / Login