#define DELAY 5
#define MAX 50

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

void setup() {
  // saída display
  DDRD = 0xFF; //DDRx (1) saida (0) entrada
  PORTD = ~display7seg[0];

  // configurar entrada teclado
  DDRB = 0xFF;
  PORTB = 0b00000000;
}

void loop() {
  uint16_t number = 15;

  PORTD = ~display7seg[14];
  PORTB = 0b00001000;
  PORTB = 0x00;
  delay(DELAY);

  PORTD = ~display7seg[13];
  PORTB = 0b00000100;
  PORTB = 0x00;
  delay(DELAY);

  PORTD = ~display7seg[14];
  PORTB = 0b00000010;
  PORTB = 0x00;
  delay(DELAY);

  PORTD = ~display7seg[15];
  PORTB = 0b00000001;
  PORTB = 0x00;
  delay(DELAY);

}

void printDigit(uint16_t N)
{
    // To store the digit
    // of the number N
    uint16_t arr[MAX];
    uint16_t i = 0;
    uint16_t j, r;
  
    // Till N becomes 0
    while (N != 0) {
  
        // Extract the last digit of N
        r = N % 10;
  
        // Put the digit in arr[]
        arr[i] = r;
        i++;
  
        // Update N to N/10 to extract
        // next last digit
        N = N / 10;
    }
  
    // Print the digit of N by traversing
    // arr[] reverse
    for (j = i - 1; j > -1; j--) {

    }
}