2 digits 7 segment display

Hi,

I need help with programming 2digit 7 segmend display (common cathode). I need for example display to show number 32, I tried some codes from internet, but didn't work.
I am using arduino nano. 7 Segment pins are connected in next order:
A segment on pin 2
B segment on pin 3
C segment on pin 4
D segment on pin 5
E segment on pin 6
F segment on pin 7
G segment on pin 8
DP on pin 9
And for the flag pins of 7 segment:
1st cathode is connected to pin 14
2nd cathode is connected to pin 15

We can't help with code we can't see.

Don't forget the code tags.

And a definition of what "didn't work" means

#include <LEDDisplay.h>
LEDDisplay *led;

void setup()
{
int digitFlagPins[] = {14, 15};
int segmentPins[] = {2, 3, 4, 5 ,6 ,7 ,8, 9};
int decimalPointPin = 9;
led = new LEDDisplay(2, digitFlagPins, segmentPins, decimalPointPin);
}

void loop()
{
led->displayNumber(3, 1);
led->displayNumber(2, 0);
}

This is the code, it only writes 88 on both segments

Can you post a link to the site /tutorial etc. where you got this code ?
Displaying "88" shows that this not completely hopeless.

Hi,
look this link:

RV mineirin

this is the link I was using

That is a common anode display. You'll probably have to make some changes to get yours common cathode display to work.

Nevertheless the flag pins, in my case 14 and 15 turn on left or right segment
Its a bit chaos but you can see that displays are working

I'll just check that we are using the same terminology. If we have the two digit number 42, the first digit 4 is a flag ? A segment is a part of a digit in the display, for example the middle bar in an "8".

It may be good if you could draw a schematic diagram of the main connections including current limiting resistors etc.

No, flags are cathodes that are connected to pin 14 and 15.
They are connected across resistors to pins 14 and 15.

OK. It is usual to have the current limiting resistors on the segments, not the common cathodes [flags]. This give optimal brightness and consistent illumination irrespective of whether a 1 (only 2 segments) or an 8 (all seven segments) is displayed.
A schematic is still needed.

In what programm do you wish that I draw the shematic?

Slow down the updating so you can see the results.


This is the best I can do, its single digit on picture, but dual digit irl.
Online editor had only single.

Can you see the individual #s using this?

void loop()
{
led->displayNumber(3, 1);
delay(500);
led->displayNumber(2, 0);
delay(500);
}

Yes, but it does not show 3 and 2
It shows 4 with G segment off and 1 and it shows DP segments on
I tries counter code from 0 to 99 and it showed all numbers correctly

Well, if you have code which appears to perform correctly, then post that.

#include <SevSeg.h>

SevSeg myDisplay;
unsigned long timer;
int deciSecond = 0;

void setup()
{

  int displayType = COMMON_CATHODE; 
  int digit1 = 14; 
  int digit2 = 15; 
  int digit3 = 0;
  int digit4 = 0;
  int segA = 2; 
  int segB = 3;
  int segC = 4; 
  int segD = 5; 
  int segE = 6; 
  int segF = 7; 
  int segG = 8; 
  int segDP= 9; 

  int numberOfDigits = 2; 
  myDisplay.Begin(displayType, numberOfDigits, digit1, digit2, digit3, digit4, segA, segB, segC, segD, segE, segF, segG, segDP);
  myDisplay.SetBrightness(100); 

  timer = millis();
}

void loop()
{
  char tempString[10]; 
  sprintf(tempString, "%2d", deciSecond); 

  myDisplay.DisplayString(tempString, 0); 


  if (millis() - timer >= 1000)
  {
    timer = millis();
    deciSecond++;
  }

  if( deciSecond >=100) deciSecond =0;

  delay(5);
}

This works correctly, but this is counter code

OK. But that is using a completely different library. What do you want to do ? just write individual numbers to the display ? If so, look in the documentation for the library SevSeg.h.
You will see the methods listed like DisplayString(tempString, 0) etc. for that purpose.