#define NUM_PINS 7

const int pins_1[NUM_PINS] = {23, 22, 19, 18, 5, 17, 16};
const int pins_2[NUM_PINS] = {14, 21, 13, 26, 25, 27, 12};

const int data_1[10][NUM_PINS] = {
  // a,b,c,d,e,f,g 
    {0, 0, 0, 0, 0, 0, 1}, //0
    {1, 0, 0, 1, 1, 1, 1}, //1
    {0, 0, 1, 0, 0, 1, 0}, //2
    {0, 0, 0, 0, 1, 1, 0}, //3 
    {1, 0, 0, 1, 1, 0, 0}, //4
    {0, 1, 0, 0, 1, 0, 0}, //5
    {0, 1, 0, 0, 0, 0, 0}, //6
    {0, 0, 0, 1, 1, 1, 1}, //7
    {0, 0, 0, 0, 0, 0, 0}, //8
    {0, 0, 0, 0, 1, 0, 0}  //9
};

const int data_2[10][NUM_PINS] = {
  // a,b,c,d,e,f,g 
    {0, 0, 0, 0, 0, 0, 1}, //0
    {1, 0, 0, 1, 1, 1, 1}, //1
    {0, 0, 1, 0, 0, 1, 0}, //2
    {0, 0, 0, 0, 1, 1, 0}, //3 
    {1, 0, 0, 1, 1, 0, 0}, //4
    {0, 1, 0, 0, 1, 0, 0}, //5
    {0, 1, 0, 0, 0, 0, 0}, //6
    {0, 0, 0, 1, 1, 1, 1}, //7
    {0, 0, 0, 0, 0, 0, 0}, //8
    {0, 0, 0, 0, 1, 0, 0}  //9
};

int counter = 0;

void setup()
{
  for (int x = 0; x < NUM_PINS; x++)
  {
    pinMode(pins_1[x], OUTPUT);
    pinMode(pins_2[x], OUTPUT);
  }
}

void loop()
{
  for (int y = 0; y <= 9; y++)
  {
    displayNumber(counter / 10, data_2);
    displayNumber(counter % 10, data_1);
    delay(1500);

    if (counter < 99)
    {
      counter++;
    }
    else
    {
      counter = 0;
    }
  }
}
void displayNumber(int number, const int data[][NUM_PINS])
{
  for (int x = 0; x < NUM_PINS; x++)
  {

    digitalWrite(pins_1[x], data[number][x]);
    digitalWrite(pins_2[x], data[number][x]);
    
  }

  digitalWrite(pins_1[6], LOW); 
  digitalWrite(pins_2[6], HIGH); 
}