int segs[] = {2, 3, 4, 5, 6, 7, 8};
byte nums[] = {
  B0111111,
  B0000110,
  B1011011,
  B1001111,
  B1100110,
  B1101101,
  B1111101,
  B0000111,
  B1111111,
  B1101111
};
void setup() {
  // put your setup code here, to run once:
  for (int i : segs)
  {
    pinMode(i, OUTPUT);
  }

  showNum(0);
  delay(1000);
  showNum(1);
  delay(1000);
  showNum(2);
  delay(1000);
  showNum(3);
  delay(1000);
  showNum(4);
  delay(1000);
  showNum(5);
  delay(1000);
  showNum(6);
  delay(1000);
  showNum(7);
  delay(1000);
  showNum(8);
  delay(1000);
  showNum(9);

}

void loop() {
  // put your main code here, to run repeatedly:

}

void showNum(int num)
{
  int readBit;

  switch (num)
  {
    case 0:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[0], i);
        digitalWrite(segs[i], readBit);
      }
      break;

    case 1:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[1], i);
        digitalWrite(segs[i], readBit);
      }
      break;

    case 2:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[2], i);
        digitalWrite(segs[i], readBit);
      }
      break;

    case 3:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[3], i);
        digitalWrite(segs[i], readBit);
      }
      break;

    case 4:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[4], i);
        digitalWrite(segs[i], readBit);
      }
      break;

    case 5:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[5], i);
        digitalWrite(segs[i], readBit);
      }
      break;

    case 6:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[6], i);
        digitalWrite(segs[i], readBit);
      }
      break;

    case 7:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[7], i);
        digitalWrite(segs[i], readBit);
      }
      break;

    case 8:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[8], i);
        digitalWrite(segs[i], readBit);
      }
      break;

    case 9:
      for (int i = 0; i < 10; i++)
      {
        readBit = bitRead(nums[9], i);
        digitalWrite(segs[i], readBit);
      }
      break;
  }
}