2-Digit display help!

1_0.jpg (15366Bytes)
2_1.jpg (19460Bytes)

hello guys,

i have a 2 Digit display here is a link to it : http://www.ekt2.com/products/productdetails?ProductId=be2704fe-15ba-4582-9f2d-5e49eeb0eace

unfortunately i didn't find a pdf for datasheet i just got it on a paper from the shop

i managed to make a personal library for the numbers display but i need to know how to program it for 2 digits with arduino of course ! it's the first time i work with it so i need some guide pleaze to display 2 digit number for example 10 and going up 11, 12, ...

what is happening is that i can display for example 00, but when i change it to one both will change 11:

here is some codes :

void setup(){
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop(){
  //0
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
    delay(1000);
 
  //1
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
  delay(1000);
 
  //0
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
  delay(1000);
}

 

Library codes:

void setup(){
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop(){
 
  //0 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //1 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //2 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, HIGH);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //3 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //4 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //5 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, HIGH);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //6 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, HIGH);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //7 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //8 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //9 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //8. Left digit
 
  /*digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //8 Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //U Left digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  ///////////////////////////////////RIGHT DIGIT/////////////////////////////////
   
  //0 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
 
  //1 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //2 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, HIGH);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //3 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //4 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //5 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, HIGH);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //6 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, HIGH);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //7 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //8 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //9 Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //8. Right digit
 
  /*digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
  //U Right digit
 
  /*digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
  */
 
}

You really need to include

the actual part you are working with and a schematic on how it is wired.

i added the part,

i added the part, unfortunaly the pdf for datasheet didn’t find any because i searched a lot and couldnt even find the name of this display but i will try to take a picture for it

Really need a schematic.

BL-D30A-22-2-digit-LED-seven-segment-display.gif

I know the part is different, but, I would guess the pinout is similar. That said, I hope you don't have this connected directly to your arduino. The pins on your arduino are not meant to sink or source the amount of current this display is capable of requiring.

ok i added the datasheet

ok i added the datasheet pictures which i took

here’s what’s happening

There are 10 pins on the part.  8 of them correspond to the LED segments (plus the “dot”). The other two are used to select the digit by tying the segments together with a common line.  You seem to have figured out already how to display a single digit on one side or the other (or both if they are both selected).

The trick to display two different digits is to switch between them quickly.  The LED when switched off does not stop glowing immediately, so you have some time to go light up the other digit before the first one disappears.  You have to keep refreshing the display, so you can’t just set it and forget it.

First, write a function that will set the 8 segments to display a digit: displayDigit(int digit). 

Then it’s like this:

<code>

loop() {

  digitalWrite(5, HIGH);

  digitalWrite(10, LOW);

  displayDigit(1)

  delay(20);

  digitalWrite(5, LOW);

  digitalWrite(10, HIGH)

  displayDigit(5);

  delay(20);

}

</code>

There is a library in the arduino playground for a 4-digit display that you can look at for inspiration:

http://playground.arduino.cc//Main/SevenSegmentLibrary

well seems interesting, i

well seems interesting, i tried this method but not in the right way
i will try it now same as you gave me thanks a lot :slight_smile:

dude your the best ! IT

dude your the best ! IT WORKS finally ! pain is over you understood what i need from the first time !!

but the count not because the number flashes for a millisec and stop for the digit on the right !! i guess i must use 2 loops one for the left digit and the other for the right digit

thank you

and thanks for all :slight_smile:

here are the new codes :

void loop(){
    digitalWrite(6, HIGH);
    digitalWrite(11, LOW);
    displayDigit(1);
    delay(10);
    digitalWrite(6, LOW);
    digitalWrite(11, HIGH);
    displayDigit(5);
    delay(10);
   
    delay(1000);
   
    digitalWrite(6, HIGH);
    digitalWrite(11, LOW);
    displayDigit(2);
    delay(1000);
    digitalWrite(6, LOW);
    digitalWrite(11, HIGH);
    displayDigit(5);
    delay(10);
   
    delay(1000);
   
    digitalWrite(6, HIGH);
    digitalWrite(11, LOW);
    displayDigit(3);
    delay(10);
    digitalWrite(6, LOW);
    digitalWrite(11, HIGH);
    displayDigit(5);
    delay(10);
   
    delay(1000);
   
  }

Here is what I came up with.

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const byte ONES = 6; //connected to pin 5 on the display
const byte TENS = 11; //connected to pin 10 on the display
const byte DIGITS[10] = {B11111100, B01100000, B11011010, B11110010,
B01100110, B10110110, B10111110, B11100000, B11111110, B11110110};
const byte LEDPINS[8] = {2, 3, 4, 5, 7, 8, 9, 10}; // A, B, C, D, E, F, G, DP
const byte MAXCOUNT = 20;
const byte COUNTSTEP = 5;
const int DELAY = 1000; //time in milliS to delay

void setup() {
for (int i = 0; i < 8; i++) {
pinMode(LEDPINS[i], OUTPUT);
}
pinMode(ONES, OUTPUT);
digitalWrite(ONES, LOW);
pinMode(TENS, OUTPUT);
digitalWrite(TENS, LOW);
}

void loop() {
byte count = 0;
while (count < MAXCOUNT) {
displayNum(count);
count += COUNTSTEP;
}
}

void displayNum(byte num) {
byte onesPlace = num % 10;
byte tensPlace = num / 10;
unsigned long currentMillis = millis();
long previousMillis = currentMillis;
while (currentMillis - previousMillis < DELAY) {
loadNum(tensPlace);
digitalWrite(TENS, HIGH);
loadNum(onesPlace);
delay(2); // wait long enough to illuminate the digit
digitalWrite(TENS, LOW);
digitalWrite(ONES, HIGH);
delay(2);
digitalWrite(ONES, LOW);
currentMillis = millis();
}
}

void loadNum(byte num) {
for (int i = 0; i < 8; i++) {
digitalWrite(LEDPINS[i], bitRead(DIGITS[num], i));
}
}

I make no promises. It looks more or less correct. It compiles. I will wait for the smart guys to critique it.

thanks a lot for thati must

thanks a lot for that

i must dig in this more so i can get all the synthax because for example i still don’t really know where to use a byte !!

I am pretty sure I made a minor error in my code.

firashelou has been emailing me to get a better grasp on what is happening in my code. Once we got to our current point in the discussion, I felt it needed to be brought back to the forum post.

Two arrays.

const byte DIGITS[10] = {B11111100, B01100000, B11011010, B11110010,
 B01100110, B10110110, B10111110, B11100000, B11111110, B11110110};
const byte LEDPINS[8] = {2, 3, 4, 5, 7, 8, 9, 10}; // A, B, C, D, E, F, G,
DP
The seven segment display labels its segments from the top counter clockwise a, b, c, d, e, f, g, and decimal point. If you light up a through f you will get a 0 (zero). g is the crossbar. The DIGITS[] describes the numbers from 0 through 9. The LEDPINS[] allows you to choose which pins will be used to light up your display.
The loadNum() sets the pins to generate the given number. I would suggest you read up on bitRead to see what it does.
The displayNum() accepts the number that will be shown. onesPlace will get the number that is in the ones place. tensPlace will contain the number in the tens place. All of the millis statements are there for a non blocking delay. Again, if you don’t understand read up on it. After reading though the code again, I see I made an error.
void displayNum(byte num) {
 byte onesPlace = num % 10;
 byte tensPlace = num / 10;
 unsigned long currentMillis = millis();
 long previousMillis = currentMillis;
 while (currentMillis - previousMillis < DELAY) {
   loadNum(tensPlace);
   digitalWrite(TENS, HIGH);
   loadNum(onesPlace); //<— This line needs to be moved.
   delay(2); // wait long enough to illuminate the digit
   digitalWrite(TENS, LOW);
   digitalWrite(ONES, HIGH);
   delay(2);
   digitalWrite(ONES, LOW);
   currentMillis = millis();
 }
}
void displayNum(byte num) {
 byte onesPlace = num % 10;
 byte tensPlace = num / 10;
 unsigned long currentMillis = millis();
 long previousMillis = currentMillis;
 while (currentMillis - previousMillis < DELAY) {
   loadNum(tensPlace);
   digitalWrite(TENS, HIGH);
   delay(2); // wait long enough to illuminate the digit
   digitalWrite(TENS, LOW);
   loadNum(onesPlace); //<-- This line needs to be moved here.
   digitalWrite(ONES, HIGH);
   delay(2);
   digitalWrite(ONES, LOW);
   currentMillis = millis();
 }
}
The line I pointed out needs to be moved. Otherwise, you will not see the correct digits displayed, or, there will be some flickering that is unwanted.
Everything that happens inside the while loop just displays the numbers for about 1 second.

well what I can say is that

well what I can say is that 2 digits is one  more than 1 and 1 less than 3! hold on… refill time