akhtar
Published © CC BY

Simple 0-9 Counter

Displays the numbers 0-9 on the display, at one second intervals implemented using 5611AH - 8-segment display

BeginnerProtip17,181
Simple 0-9 Counter

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
7 Segment LED Display, InfoVue
7 Segment LED Display, InfoVue
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Resistor 1k ohm
Resistor 1k ohm
×2
Jumper wires (generic)
Jumper wires (generic)
×10

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Connection diagram

Circuit connection diagram

Designed using Fritzing

Code

0-9 Counter using Arduino & 5611AH 7-segment display

Arduino
Just paste this code in the arduino editor and compile it before flashing it on your arduino uno.
/*
  Displays the numbers 0-9 on the display, at one second intervals
  Implemented using 5611AH - 8-segment display
  Pin assignment for 5611AH
     G  F com A  B
   __|__|__|__|__|__
  | 10  9  8  7  6  |
  |  1  2  3  4  5  |
   --|--|--|--|--|--
     E  D com C  P
     
  A=7,B=6,C=4,D=2,E=1,F=9,G=10,P=5,com=GND
  LED segment assignment corresponding to pins
    A
   ---
F |   | B
  | G |
   ---
E |   | C
  |   |
   ---  . P
    D
*/
 
// Pin 2-8 is connected to the 7 segments of the display.

int pinA = 8;
int pinB = 9;
int pinC = 4;
int pinD = 3;
int pinE = 2;
int pinF = 7;
int pinG = 6;
int pinP = 5;

/*
int D1 = 10;
int D2 = 11;
int D3 = 12;
int D4 = 13;
*/

void setup() {                
// initialize the digital pins as outputs.
  pinMode(pinA, OUTPUT);     
  pinMode(pinB, OUTPUT);     
  pinMode(pinC, OUTPUT);     
  pinMode(pinD, OUTPUT);     
  pinMode(pinE, OUTPUT);     
  pinMode(pinF, OUTPUT);     
  pinMode(pinG, OUTPUT);   
  pinMode(pinP, OUTPUT);   
/*
  pinMode(D1, OUTPUT);  
  pinMode(D2, OUTPUT);  
  pinMode(D3, OUTPUT);  
  pinMode(D4, OUTPUT);  
*/
}

void loop() {
//0
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, HIGH);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, LOW);   
  digitalWrite(pinP, LOW);   
  delay(500);               // wait for a second
  
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, HIGH);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, LOW);   
  digitalWrite(pinP, HIGH);   
  delay(500);

//1
  digitalWrite(pinA, LOW);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, LOW);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, LOW);   
  digitalWrite(pinG, LOW);   
  digitalWrite(pinP, LOW);  
  delay(500);               // wait for a second

  digitalWrite(pinA, LOW);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, LOW);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, LOW);   
  digitalWrite(pinG, LOW);   
  digitalWrite(pinP, HIGH);  
  delay(500);

//2
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, LOW);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, HIGH);   
  digitalWrite(pinF, LOW);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, LOW);  
  delay(500);               // wait for a second

  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, LOW);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, HIGH);   
  digitalWrite(pinF, LOW);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, HIGH);  
  delay(500);
  
//3
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, LOW);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, LOW);  
  delay(500);               // wait for a second

  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, LOW);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, HIGH);  
  delay(500);

//4
  digitalWrite(pinA, LOW);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, LOW);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, LOW);  
  delay(500);               // wait for a second
  
  digitalWrite(pinA, LOW);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, LOW);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, HIGH);  
  delay(500);

//5
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, LOW);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, LOW);  
  delay(500);               // wait for a second
  
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, LOW);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, HIGH);  
  delay(500);

//6
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, LOW);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, HIGH);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, LOW);  
  delay(500);               // wait for a second
  
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, LOW);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, HIGH);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, HIGH);  
  delay(500);
  
//7
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, LOW);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, LOW);   
  digitalWrite(pinG, LOW);   
  digitalWrite(pinP, LOW);  
  delay(500);               // wait for a second
  
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, LOW);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, LOW);   
  digitalWrite(pinG, LOW);   
  digitalWrite(pinP, HIGH);  
  delay(500);
    
//8
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, HIGH);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, LOW);  
  delay(500);               // wait for a second
  
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, HIGH);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, HIGH);  
  delay(500);
  
//9
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, LOW);  
  delay(500);               // wait for a second
  
  digitalWrite(pinA, HIGH);   
  digitalWrite(pinB, HIGH);   
  digitalWrite(pinC, HIGH);   
  digitalWrite(pinD, HIGH);   
  digitalWrite(pinE, LOW);   
  digitalWrite(pinF, HIGH);   
  digitalWrite(pinG, HIGH);   
  digitalWrite(pinP, HIGH);  
  delay(500);

}

Credits

akhtar

akhtar

2 projects • 0 followers

Comments