displaying numbers on a 7 segment display

Hello
I have been trying for a while to show hours and minutes on a 7 segment display, obviously I have tried several methods found on google. With this program, the display clearly shows a figure on digit 4, but I can see a flicker, like it is trying to show all the figures. The problem would be the delay function?

//Common Anode Display
/* d1 a f d2 d3 b
   e d dp c g d4*/

  // select pin for cathode
  int a = 1;
  int b = 2;
  int c = 3;
  int d = 4;
  int e = 5;
  int f = 6;
  int g = 7;
  int dp = 8;
  // select pin for anode
  int d4 = 9;
  int d3 = 10;
  int d2 = 11;
  int d1 = 12;
  // set variable
  long n = 1230;
  int x = 100;

// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
#include "RTClib.h"

RTC_DS3231 rtc;

int hours, minutes;
   
  void setup()
  {
    pinMode(d1, OUTPUT);
    pinMode(d2, OUTPUT);
    pinMode(d3, OUTPUT);
    pinMode(d4, OUTPUT);
    pinMode(a, OUTPUT);
    pinMode(b, OUTPUT);
    pinMode(c, OUTPUT);
    pinMode(d, OUTPUT);
    pinMode(e, OUTPUT);
    pinMode(f, OUTPUT);
    pinMode(g, OUTPUT);
    pinMode(dp, OUTPUT);

    #ifndef ESP8266
  while (!Serial); // for Leonardo/Micro/Zero
#endif

  Serial.begin(9600);

  delay(3000); // wait for console opening

  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  if (rtc.lostPower()) {
    Serial.println("RTC lost power, lets set the time!");
    // following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
  }
/////////////////////////////////////////////////////////////
void loop()

{
    DateTime now = rtc.now();
    hours = now.hour();
    minutes = now.minute();
    int units = hours % 10;
    int tens = hours / 10;
    int unitss = minutes % 10;
    int tenss = minutes / 10;

    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    /*Serial.print("Temperature: ");
    Serial.print(rtc.getTemperature());
    Serial.println(" C");
    Serial.println();*/
    WeiXuan(1); pickNumber(tens);
    WeiXuan(2); pickNumber(units);
    WeiXuan(3); pickNumber(tenss);
    WeiXuan(4); pickNumber(unitss);

delay(3000);
}
///////////////////////////////////////////////////////////////
void WeiXuan(unsigned char m)//
{
    switch(m)
     {
  case 1: 
    digitalWrite(d1,LOW);
    digitalWrite(d2, HIGH);
    digitalWrite(d3, HIGH);
    digitalWrite(d4, HIGH);   
   break;
   case 2: 
    digitalWrite(d1, HIGH);
    digitalWrite(d2, LOW);
    digitalWrite(d3, HIGH);
    digitalWrite(d4, HIGH); 
      break;
    case 3: 
     digitalWrite(d1,HIGH);
     digitalWrite(d2, HIGH);
     digitalWrite(d3, LOW);
     digitalWrite(d4, HIGH); 
      break;
    case 4: 
     digitalWrite(d1, HIGH);
     digitalWrite(d2, HIGH);
     digitalWrite(d3, HIGH);
     digitalWrite(d4, LOW); 
      break;
        default :
           digitalWrite(d1, HIGH);
           digitalWrite(d2, HIGH);
           digitalWrite(d3, HIGH);
           digitalWrite(d4, HIGH);
             break;
    }
}
void Num_0()
{
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, LOW);
  digitalWrite(dp,LOW);
}
void Num_1()
{
  digitalWrite(a, LOW);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
  digitalWrite(dp,LOW);
}
void Num_2()
{
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, LOW);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, LOW);
  digitalWrite(g, HIGH);
  digitalWrite(dp,LOW);
}
void Num_3()
{
  digitalWrite(a, HIGH);

  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, HIGH);
  digitalWrite(dp,LOW);
}
void Num_4()
{
  digitalWrite(a, LOW);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(dp,LOW);
}
void Num_5()
{
  digitalWrite(a, HIGH);
  digitalWrite(b, LOW);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, LOW);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(dp,LOW);
}
void Num_6()
{
  digitalWrite(a, HIGH);
  digitalWrite(b, LOW);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(dp,LOW);

}
void Num_7()
{
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
  digitalWrite(dp,LOW);
}
void Num_8()
{
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(dp,LOW);
}
void Num_9()
{
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, LOW);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(dp,LOW);
}
void Clear()  // clear the screen
{
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);

  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
  digitalWrite(dp,LOW);
}
void pickNumber(unsigned char n)// select number
{
  switch(n)
  {
   case 0:Num_0();
   break;
   case 1:Num_1();
   break;
   case 2:Num_2();
   break;
   case 3:Num_3();
   break;
   case 4:Num_4();
   break;
   case 5:Num_5();
   break;
   case 6:Num_6();
   break;
   case 7:Num_7();
   break;
   case 8:Num_8();
   break;
   case 9:Num_9();
   break;
   default:Clear();
   break; 
  }
}
/*void Display(unsigned char x, unsigned char Number)//  take x as coordinate and display number
{
  WeiXuan(x);
  pickNumber(Number);
 //delay(1000);
 //Clear() ; // clear the screen
}*/

Yes, you should get rid of the delay, and only display when the time changes. You just have to keep the value of the units of the minutes and display time if this value is different from the previous value (which you update at that moment).

You are trying to multiplex thru the 4 digits, yes?

WeiXuan(1); pickNumber(tens);
WeiXuan(2); pickNumber(units);
WeiXuan(3); pickNumber(tenss);
WeiXuan(4); pickNumber(unitss);

Right now the code blasts thru the 4 digits quickly, then sits on the last one for 3 seconds.
You need to use blink without delay style code to cycle thru those, updating every 3-5mS or so,
and during other times check to see if 3 seconds have passed to do the serial prints & stuff.

Your code changes the digit selection while the segments are still being driven.

You need to do this to multiplex a 7seg display:

switch off segments
change digit selection
switch on new segments
delay

If you leave the old segments enabled while switching digits you'll get ghosting/smearing of
the numbers.

MarkT:
Your code changes the digit selection while the segments are still being driven.

You need to do this to multiplex a 7seg display:

switch off segments
change digit selection
switch on new segments
delay

If you leave the old segments enabled while switching digits you'll get ghosting/smearing of
the numbers.

Would be something like this:

digitalWrite( DIG1, LOW); //digit 1
pickNumber(tens);
delay(4);
digitalWrite( DIG1, HIGH);

digitalWrite( DIG2, LOW); //digit 2
pickNumber(units);
delay(4);
digitalWrite( DIG2, HIGH);

digitalWrite( DIG3, LOW); //digit 3
pickNumber(tenss);
delay(4);
digitalWrite( DIG3, HIGH);

digitalWrite( DIG4, LOW); //digit 4
pickNumber(unitss);
delay(4);
digitalWrite( DIG4, HIGH);

Let us see how this tutorial goes for a 6-digit (HRS:MIN:SEC) clock system based on DS3231 RTC Module. The display unit is of multiplexed type made of cc (common cathode) 7-segment display devices. The display unit is updated at 1-sec interval using the 1-sec elapsed time of the RTC (not the delay(1000) function). The 7-segment display is a direct driven multiplexed display unit (no display controller like MAX7219), and there is absolutely no flickering.

1. Let us build the following circuit using DS3231RTC, UNO, and Display Unit.
fourDigitMuxDisplay.png

2. Upload the following sketch.

#include <Wire.h>
#include "RTClib.h"

byte lupTable[] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F}; //LUP table: CC vs Digit
byte ccTime[6];  //HRS MIN SEC

byte prSec = 0;
RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup ()
{
  Serial.begin(9600);
  rtc.begin();
  DDRB = 0xFF;
  DDRD = 0xFF;
  DDRC = 0xFF;
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}

void loop ()
{
  showTimeSM();             //show Date Time on Serial Monitor
  showTime7SD();           //show Time on 7-segment Display Unit
  
  //--------- checking if RTC has counted 1-sec elpse time----------------------
  prSec = bcdSecond();   //current second of RTC
  while (bcdSecond() - prSec != 1)
  {
    showTime7SD();   //refresh display while 1-sec time of RTC is being elapsed
  }
  prSec = bcdSecond(); //delay(1000);
  //-----------------------------------------
}

byte bcdSecond()
{
  DateTime nowTime = rtc.now();
  if (nowTime.second() == 0 )
  {
    prSec = 0;
    return prSec;
  }
  else
  {
    DateTime nowTime = rtc.now();
    return nowTime.second();
  }
}

void showTimeSM()
{
  DateTime myNow = rtc.now();

  Serial.print(myNow.year(), DEC);
  Serial.print('/');
  Serial.print(myNow.month(), DEC);
  Serial.print('/');
  Serial.print(myNow.day(), DEC);
  Serial.print(" (");
  Serial.print(daysOfTheWeek[myNow.dayOfTheWeek()]);
  Serial.print(") ");
  Serial.print(myNow.hour(), DEC);
  Serial.print(':');
  Serial.print(myNow.minute(), DEC);
  Serial.print(':');
  byte x = myNow.second();
  if (x < 10)
  {
    Serial.print('0');
  }
  Serial.print(myNow.second(), DEC);
  Serial.println();
}

void showTime7SD()
{
  DateTime myNow = rtc.now();
  //---------------------------
  byte bcdHour = myNow.hour();
  byte bcdHourOne = bcdHour % 10;
  byte bcdHourTen = bcdHour / 10;
  ccTime[0] = lupTable[bcdHourTen];
  ccTime[1] = lupTable[bcdHourOne];
  //---------------------------
  byte bcdMin = myNow.minute();
  byte bcdMinOne = bcdMin % 10;
  byte bcdMinTen = bcdMin / 10;
  ccTime[2] = lupTable[bcdMinTen];
  ccTime[3] = lupTable[bcdMinOne];
  //---------------------------
  byte bcdSec = myNow.second();
  byte bcdSecOne = bcdSec % 10;
  byte bcdSecTen = bcdSec / 10;
  ccTime[4] = lupTable[bcdSecTen];
  ccTime[5] = lupTable[bcdSecOne];
  //---------------------------
  byte x = ccTime[0]; //HourTen
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111110;
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  delay(1);
  // ------------------------------ 
  x = ccTime[1]; //HourOne
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111101;
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  delay(1);
  //----------------------------------
 x = ccTime[2]; //MinTen
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111011;
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  delay(1);
  //------------------------------------
  x = ccTime[3]; //MinOne
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b110111;
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  delay(1);
  //-------------------------------------
  x = ccTime[4]; //SecTen
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111111;
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(1);
  //------------------------------------
  x = ccTime[5]; //SecOne
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111111;
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  delay(1);
  //-------------------------------------
}

3. Check that the display unit shows flicker free time in 24-hrs format at 1-sec interval both on Serial Monitor and on 7-segment Display Unit.
SMrtc.png

rtc7seg2.png

SMrtc.png

fourDigitMuxDisplay.png

rtc7seg2.png

GolamMostafa:
Let us see how this tutorial goes for a 6-digit (HRS:MIN:SEC) clock system based on DS3231 RTC Module. The display unit is of multiplexed type made of cc (common cathode) 7-segment display devices. The display unit is updated at 1-sec interval using the 1-sec elapsed time of the RTC (not the delay(1000) function). The 7-segment display is a direct driven multiplexed display unit (no display controller like MAX7219), and there is absolutely no flickering.

1. Let us build the following circuit using DS3231RTC, UNO, and Display Unit.
fourDigitMuxDisplay.png

2. Upload the following sketch.

#include <Wire.h>

#include "RTClib.h"

byte lupTable[] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F}; //LUP table: CC vs Digit
byte ccTime[6];  //HRS MIN SEC

byte prSec = 0;
RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup ()
{
  Serial.begin(9600);
  rtc.begin();
  DDRB = 0xFF;
  DDRD = 0xFF;
  DDRC = 0xFF;
  rtc.adjust(DateTime(F(DATE), F(TIME)));
}

void loop ()
{
  showTimeSM();            //show Date Time on Serial Monitor
  showTime7SD();          //show Time on 7-segment Display Unit
 
  //--------- checking if RTC has counted 1-sec elpse time----------------------
  prSec = bcdSecond();  //current second of RTC
  while (bcdSecond() - prSec != 1)
  {
    showTime7SD();  //refresh display while 1-sec time of RTC is being elapsed
  }
  prSec = bcdSecond(); //delay(1000);
  //-----------------------------------------
}

byte bcdSecond()
{
  DateTime nowTime = rtc.now();
  if (nowTime.second() == 0 )
  {
    prSec = 0;
    return prSec;
  }
  else
  {
    DateTime nowTime = rtc.now();
    return nowTime.second();
  }
}

void showTimeSM()
{
  DateTime myNow = rtc.now();

Serial.print(myNow.year(), DEC);
  Serial.print('/');
  Serial.print(myNow.month(), DEC);
  Serial.print('/');
  Serial.print(myNow.day(), DEC);
  Serial.print(" (");
  Serial.print(daysOfTheWeek[myNow.dayOfTheWeek()]);
  Serial.print(") ");
  Serial.print(myNow.hour(), DEC);
  Serial.print(':');
  Serial.print(myNow.minute(), DEC);
  Serial.print(':');
  byte x = myNow.second();
  if (x < 10)
  {
    Serial.print('0');
  }
  Serial.print(myNow.second(), DEC);
  Serial.println();
}

void showTime7SD()
{
  DateTime myNow = rtc.now();
  //---------------------------
  byte bcdHour = myNow.hour();
  byte bcdHourOne = bcdHour % 10;
  byte bcdHourTen = bcdHour / 10;
  ccTime[0] = lupTable[bcdHourTen];
  ccTime[1] = lupTable[bcdHourOne];
  //---------------------------
  byte bcdMin = myNow.minute();
  byte bcdMinOne = bcdMin % 10;
  byte bcdMinTen = bcdMin / 10;
  ccTime[2] = lupTable[bcdMinTen];
  ccTime[3] = lupTable[bcdMinOne];
  //---------------------------
  byte bcdSec = myNow.second();
  byte bcdSecOne = bcdSec % 10;
  byte bcdSecTen = bcdSec / 10;
  ccTime[4] = lupTable[bcdSecTen];
  ccTime[5] = lupTable[bcdSecOne];
  //---------------------------
  byte x = ccTime[0]; //HourTen
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111110;
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  delay(1);
  // ------------------------------
  x = ccTime[1]; //HourOne
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111101;
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  delay(1);
  //----------------------------------
x = ccTime[2]; //MinTen
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111011;
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  delay(1);
  //------------------------------------
  x = ccTime[3]; //MinOne
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b110111;
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  delay(1);
  //-------------------------------------
  x = ccTime[4]; //SecTen
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111111;
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(1);
  //------------------------------------
  x = ccTime[5]; //SecOne
  PORTB = x;
  digitalWrite(6, bitRead(x, 6));
  digitalWrite(7, bitRead(x, 7));
  //-----------
  PORTC = 0b111111;
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  delay(1);
  //-------------------------------------
}




**3.** Check that the display unit shows flicker free time in 24-hrs format at 1-sec interval both on Serial Monitor and on 7-segment Display Unit.
![SMrtc.png|611x335](upload://ybjEt8inRCz8rl6egiJWu26oxPT.png)

![rtc7seg2.png|482x362](upload://6EspuVFOj3c6Oe2JaHKSHDN4qvb.png)

What about this code:
/* d1 a f d2 d3 b
e d dp c g d4*/
/a->q0
b->q1
c->q2
d->q3
e->q4
f->q5
g->q6
/
/OE->gnd
MR->vcc
/
int latchPin = 2; //pin 12(ST_CP) on the 595
int dataPin = 3; //pin 14(DS) on the 595
int clockPin = 4; //pin 11(SH_CP) on the 595

int unit;
int tens;
int hours, minutes;
const byte SevenSegmentDigits[10] = {63, 6, 91, 79, 102, 109, 125, 7, 127, 111};
// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
#include "RTClib.h"

RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup() {
Serial.begin(9600);
pinMode(9,OUTPUT);// digit 4
pinMode(10,OUTPUT);// digit 1
pinMode(11,OUTPUT);//digit 2
pinMode(12,OUTPUT);// digit 3
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
#ifndef ESP8266
while (!Serial); // for Leonardo/Micro/Zero
#endif

Serial.begin(9600);

delay(3000); // wait for console opening

if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}

if (rtc.lostPower()) {
Serial.println("RTC lost power, lets set the time!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(DATE), F(TIME)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
}

void loop(){
DateTime now = rtc.now();
ora = now.hour();
minut = now.minute();
int units = hours % 10;
int tens = hours / 10;
int unitss = minutes % 10;
int tenss = minutes / 10;

Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
Serial.print("Temperature: ");
Serial.print(rtc.getTemperature());
Serial.println(" C");
Serial.println();

units = SevenSegmentDigits[hours % 10];
tens = SevenSegmentDigits[hours / 10];
unitss = SevenSegmentDigits[minutes % 10];
tenss = SevenSegmentDigits[minutes / 10];

digitalWrite(9, LOW);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, tens); // The thousand digit is sent
digitalWrite(latchPin, HIGH); // Set latch pin HIGH to store the inputs
digitalWrite(9, HIGH); // Turinig on that thousands digit
//delay(5); // delay for multiplexing

digitalWrite(10, LOW);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, units); // The hundered digit is sent
digitalWrite(latchPin, HIGH);
digitalWrite(10, HIGH);
//delay(5);

digitalWrite(11, LOW);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, tenss); // The tens digit is sent
digitalWrite(latchPin, HIGH);
digitalWrite(11, HIGH);
//delay(5);

digitalWrite(12, LOW);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, unitss); // The last digit is sent
digitalWrite(latchPin, HIGH);
digitalWrite(12, HIGH);
//delay(5);

//delay(1000);
}

The numbers have very low light intensity. Would this be the same problem with multiplexing?