#define DATA 6      // connect to pin 14 on the 74HC595
#define LATCH 8     // connect to pin 12 on the 74HC595
#define CLOCK 10    // connect to pin 11 on the 74HC595
// set up the array with the segments for 0 to 9, A to F (from Table 6-2)
int data [] = {252, 96, 218, 242, 102, 182, 190, 224, 254, 246, 238, 62, 156, 122, 158, 142};
void setup() {
  pinMode(LATCH, OUTPUT);
  pinMode(CLOCK, OUTPUT);
  pinMode(DATA, OUTPUT);
}
void loop() {
   {
    displayNumber(01);
    delay(100);
  }
}
void displayNumber(int n) {
  int left, right = 0;
  if (n < 10) {
    digitalWrite(LATCH, LOW);
    shiftOut(DATA, CLOCK, LSBFIRST, data [n]);
   shiftOut(DATA, CLOCK, LSBFIRST, 0);
    digitalWrite(LATCH, HIGH);
  }
  else if (n >= 10) {
    right = n % 10;   // remainder of dividing the number to display by 10
    left = n / 10;  // quotient of dividing the number to display by 10
    digitalWrite(LATCH, LOW);
    shiftOut(DATA, CLOCK, LSBFIRST, data [right]);
    shiftOut(DATA, CLOCK, LSBFIRST, data [left]);
    digitalWrite(LATCH, HIGH);
  }
}