Instructables
This instructable is more for its code then any thing else. I remember my beginning days of Arduino, I had a difficulty doing this LED display because I did not have a clear knowledge of Arrays (and i still don't) so I had a hard time finding a examples that did not use Arrays, so after a while I succeeded in making it this way.

So to all the other people who don't understand Arrays here is another way of making a 4 digit 7 segment display work.

int aPin = 2;  //                     A
int bPin = 3;  //             ________
int cPin = 4;  //           |                   |
int dPin = 5;  //       F  |                   |  B
int ePin = 6;  //           |         G       |
int fPin = 7;  //            |________|
int gPin = 8;  //           |                   |
int GND1 = 9;  //        |                   |
int GND2 = 10; //   E |                   |   C
int GND3 = 11; //       |________|
int GND4 = 12; //       
int num;       //         D
int dig1 = 0;
int dig2 = 0;
int dig3 = 0;
int dig4 = 0;
int DTime = 4;


void setup()
{
  pinMode(aPin, OUTPUT);
  pinMode(bPin, OUTPUT);
  pinMode(cPin, OUTPUT);
  pinMode(dPin, OUTPUT);
  pinMode(ePin, OUTPUT); 
  pinMode(fPin, OUTPUT);
  pinMode(gPin, OUTPUT);
  pinMode(GND1, OUTPUT);
  pinMode(GND2, OUTPUT);
  pinMode(GND3, OUTPUT);
  pinMode(GND4, OUTPUT);
  Serial.begin(9600);
}
void loop()
{
  digitalWrite( GND1, HIGH);
  digitalWrite( GND2, HIGH);
  digitalWrite( GND3, HIGH);
  digitalWrite( GND4, HIGH);

if (Serial.available() > 0)
{
  num = Serial.parseInt();
  Serial.println(num);
  dig1 = num / 1000;
  num = num - (dig1 * 1000);
  dig2 = num / 100;
  num = num - (dig2 * 100);
  dig3 = num / 10;
  dig4 = num - (dig3 *10);
}
 
 
  digitalWrite( GND4, LOW);    //digit 4
  pickNumber(dig4);
  delay(DTime);
  digitalWrite( GND4, HIGH);
 
  digitalWrite( GND3, LOW);    //digit 3
  pickNumber(dig3);
  delay(DTime);
  digitalWrite( GND3, HIGH);
 
  digitalWrite( GND2, LOW);   //digit 2
  pickNumber(dig2);
  delay(DTime);
  digitalWrite( GND2, HIGH);
 
  digitalWrite( GND1, LOW);   //digit 1
  pickNumber(dig1);
  delay(DTime);
  digitalWrite( GND1, HIGH);

}
 
void pickNumber(int x){
   switch(x){
     case 1: one(); break;
     case 2: two(); break;
     case 3: three(); break;
     case 4: four(); break;
     case 5: five(); break;
     case 6: six(); break;
     case 7: seven(); break;
     case 8: eight(); break;
     case 9: nine(); break;
     default: zero(); break;
   }
}

void clearLEDs()
{  
  digitalWrite(  2, LOW); // A
  digitalWrite(  3, LOW); // B
  digitalWrite(  4, LOW); // C
  digitalWrite(  5, LOW); // D
  digitalWrite(  6, LOW); // E
  digitalWrite(  7, LOW); // F
  digitalWrite(  8, LOW); // G
}

void one()
{
  digitalWrite( aPin, LOW);
  digitalWrite( bPin, HIGH);
  digitalWrite( cPin, HIGH);
  digitalWrite( dPin, LOW);
  digitalWrite( ePin, LOW);
  digitalWrite( fPin, LOW);
  digitalWrite( gPin, LOW);
}

void two()
{
  digitalWrite( aPin, HIGH);
  digitalWrite( bPin, HIGH);
  digitalWrite( cPin, LOW);
  digitalWrite( dPin, HIGH);
  digitalWrite( ePin, HIGH);
  digitalWrite( fPin, LOW);
  digitalWrite( gPin, HIGH);
}

void three()
{
  digitalWrite( aPin, HIGH);
  digitalWrite( bPin, HIGH);
  digitalWrite( cPin, HIGH);
  digitalWrite( dPin, HIGH);
  digitalWrite( ePin, LOW);
  digitalWrite( fPin, LOW);
  digitalWrite( gPin, HIGH);
}

void four()
{
  digitalWrite( aPin, LOW);
  digitalWrite( bPin, HIGH);
  digitalWrite( cPin, HIGH);
  digitalWrite( dPin, LOW);
  digitalWrite( ePin, LOW);
  digitalWrite( fPin, HIGH);
  digitalWrite( gPin, HIGH);
}

void five()
{
  digitalWrite( aPin, HIGH);
  digitalWrite( bPin, LOW);
  digitalWrite( cPin, HIGH);
  digitalWrite( dPin, HIGH);
  digitalWrite( ePin, LOW);
  digitalWrite( fPin, HIGH);
  digitalWrite( gPin, HIGH);
}

void six()
{
  digitalWrite( aPin, HIGH);
  digitalWrite( bPin, LOW);
  digitalWrite( cPin, HIGH);
  digitalWrite( dPin, HIGH);
  digitalWrite( ePin, HIGH);
  digitalWrite( fPin, HIGH);
  digitalWrite( gPin, HIGH);
}

void seven()
{
  digitalWrite( aPin, HIGH);
  digitalWrite( bPin, HIGH);
  digitalWrite( cPin, HIGH);
  digitalWrite( dPin, LOW);
  digitalWrite( ePin, LOW);
  digitalWrite( fPin, LOW);
  digitalWrite( gPin, LOW);
}

void eight()
{
  digitalWrite( aPin, HIGH);
  digitalWrite( bPin, HIGH);
  digitalWrite( cPin, HIGH);
  digitalWrite( dPin, HIGH);
  digitalWrite( ePin, HIGH);
  digitalWrite( fPin, HIGH);
  digitalWrite( gPin, HIGH);
}

void nine()
{
  digitalWrite( aPin, HIGH);
  digitalWrite( bPin, HIGH);
  digitalWrite( cPin, HIGH);
  digitalWrite( dPin, HIGH);
  digitalWrite( ePin, LOW);
  digitalWrite( fPin, HIGH);
  digitalWrite( gPin, HIGH);
}

void zero()
{
  digitalWrite( aPin, HIGH);
  digitalWrite( bPin, HIGH);
  digitalWrite( cPin, HIGH);
  digitalWrite( dPin, HIGH);
  digitalWrite( ePin, HIGH);
  digitalWrite( fPin, HIGH);
  digitalWrite( gPin, LOW);
}
sacnorth1 month ago

Article is very good, I found a simpler article where he used only one 7 Segment display and drive its using a simple arduino board ,"http://ehowplus.com/diy/using-7-segement-display-using-arduino/"

BuzoterM4 months ago

You can use my lib for your device and use function Print( ) to print anything:
https://drive.google.com/file/d/0BwbPR-ixqjcZcmh4R...

Description here (sorry only russian):
http://blockduino.blogspot.com/2014/04/block7seg.h...

Raphango10 months ago
Great! Gonna try it when i get home! =D
FireCGun (author)  Raphango10 months ago
if u get stuck with something, tell me and ill try to help you
Raphango FireCGun10 months ago
I have a question:
Could you please update the instructable so it contains an image of the pinout of the 4 digit 7 segment display? You have mentioned gnd 1, gnd 2 and so on in the code but I really don't know wich pins is wich...
Thanks in advance!
FireCGun (author)  Raphango10 months ago
this is the one i used, but each display is different depend on where you bought it

http://arduino.fisch.lu/Uploads/arduino/circuit_TYC-365GWB.png
oisa FireCGun5 months ago

hello,
I really tried to follow the instructions here but i think there is something missing.

the wiring is not going well with me.

can you tell me please tell me what pin number from the DS to what digital pin on the arduino?

FireCGun (author)  Raphango10 months ago
this is the one i used, but each display is different depend on where you bought it

http://arduino.fisch.lu/Uploads/arduino/circuit_TYC-365GWB.png
Raphango FireCGun10 months ago
Ok, but in the picture below its not clear to me wich pin is wich..
In your code, you mention the following:
http://arduino.fisch.lu/Uploads/arduino/circuit_TYC-365GWB.png
void loop()
{
  digitalWrite( GND1, HIGH);
  digitalWrite( GND2, HIGH);
  digitalWrite( GND3, HIGH);
  digitalWrite( GND4, HIGH); 

But the picture doesn't show any ground...=T wich pins in the picture are the 4 grounds?
FireCGun (author)  Raphango10 months ago
D1 is GND1
D2 is GND 2
... and sp on
And the a,b,c pins are as they are
Raphango FireCGun10 months ago
Ok thanks
carss669 months ago
hi mate.this is similar to a project that i need to do,but just starting out in the world of arduino.just need some help as its got my head done in lol.i have an arduino uno v3 and an lcd 4 digit counter.want to wire the counter to arduino and program it to show 5000.then push tactile button and it counts down quit fast to zero.then reset to 5000 and continue this count down/reset each time.can anyone help with the wiring and program.
DPC-02.jpgDPC-03.jpgDPC-04.jpg