#define DATA_PIN 2   /* DS */
#define CLOCK_PIN 3  /* SHCP */
#define LATCH_PIN 4  /* STCP */

uint8_t display7seg[16] = {0x7E, 
0x30, 0x6D, 0x79, 0x33, 0x5B, 0x5F, 
0x70, 0x7F, 0x7B, 0x77, 0x1F, 0x4E, 0x3D, 0x4F, 0x47};

void atualizaDisplay(uint8_t valor);

void setup() {
  // put your setup code here, to run once:
  pinMode(DATA_PIN, OUTPUT);
  pinMode(CLOCK_PIN, OUTPUT);
  pinMode(LATCH_PIN, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  for (int c = 0; c <= 15; c++){
    atualizaDisplay(c);
  }
}

void atualizaDisplay(uint8_t valor){
  digitalWrite(LATCH_PIN, LOW);
  shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, ~display7seg[valor]);
  digitalWrite(LATCH_PIN, HIGH);
  delay(500);
}

74HC595
74HC595