void output_mode() {
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(A4, OUTPUT);
  pinMode(A5, OUTPUT);
}


void first_num_zero() {
  digitalWrite(A0, LOW); 
  digitalWrite(A1, LOW);
  digitalWrite(A2, LOW);
  digitalWrite(A3, LOW);
  digitalWrite(A4, LOW);
  digitalWrite(A5, LOW);
  digitalWrite(7, HIGH);
}
void first_num_one() {
  digitalWrite(A0, HIGH);
  digitalWrite(A1, LOW);
  digitalWrite(A2, LOW);
  digitalWrite(A3, HIGH);
  digitalWrite(A4, HIGH);
  digitalWrite(A5, HIGH);
  digitalWrite(7, HIGH);
  
}
void first_num_two() {
  digitalWrite(A0, LOW);
  digitalWrite(A1, LOW);
  digitalWrite(A2, HIGH);
  digitalWrite(A3, LOW);
  digitalWrite(A4, LOW);
  digitalWrite(A5, HIGH);
  digitalWrite(7, LOW);
}

void first_num_three() {
  digitalWrite(A0, LOW);
  digitalWrite(A1, LOW);
  digitalWrite(A2, LOW);
  digitalWrite(A3, LOW);
  digitalWrite(A4, HIGH);
  digitalWrite(A5, HIGH);
  digitalWrite(7, LOW);
}

void first_num_four() {
  digitalWrite(A0, HIGH);
  digitalWrite(A1, LOW);
  digitalWrite(A2, LOW);
  digitalWrite(A3, HIGH);
  digitalWrite(A4, HIGH);
  digitalWrite(A5, LOW);
  digitalWrite(7, LOW);
}

void first_num_five() {
  digitalWrite(A0, LOW);
  digitalWrite(A1, HIGH);
  digitalWrite(A2, LOW);
  digitalWrite(A3, LOW);
  digitalWrite(A4, HIGH);
  digitalWrite(A5, LOW);
  digitalWrite(7, LOW);
}

void first_num_six() {
  digitalWrite(A0, LOW);
  digitalWrite(A1, HIGH);
  digitalWrite(A2, LOW);
  digitalWrite(A3, LOW);
  digitalWrite(A4, LOW);
  digitalWrite(A5, LOW);
  digitalWrite(7, LOW);
}

void first_num_seven() {
  digitalWrite(A0, LOW);
  digitalWrite(A1, LOW);
  digitalWrite(A2, LOW);
  digitalWrite(A3, HIGH);
  digitalWrite(A4, HIGH);
  digitalWrite(A5, HIGH);
  digitalWrite(7, HIGH);
}

void first_num_eight() {
  digitalWrite(A0, LOW);
  digitalWrite(A1, LOW);
  digitalWrite(A2, LOW);
  digitalWrite(A3, LOW);
  digitalWrite(A4, LOW);
  digitalWrite(A5, LOW);
  digitalWrite(7, LOW);
}

void first_num_nine() {
  digitalWrite(A0, LOW);
  digitalWrite(A1, LOW);
  digitalWrite(A2, LOW);
  digitalWrite(A3, LOW);
  digitalWrite(A4, HIGH);
  digitalWrite(A5, LOW);
  digitalWrite(7, LOW);
}


void second_num_zero() {
  digitalWrite(0, LOW); 
  digitalWrite(1, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);
}
void second_num_one() {
  digitalWrite(0, HIGH);
  digitalWrite(1, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);
  
}
void second_num_two() {
  digitalWrite(0, LOW);
  digitalWrite(1, LOW);
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  digitalWrite(6, LOW);
}

void second_num_three() {
  digitalWrite(0, LOW);
  digitalWrite(1, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, LOW);
}

void second_num_four() {
  digitalWrite(0, HIGH);
  digitalWrite(1, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
}

void second_num_five() {
  digitalWrite(0, LOW);
  digitalWrite(1, HIGH);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
}

void second_num_six() {
  digitalWrite(0, LOW);
  digitalWrite(1, HIGH);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
}

void second_num_seven() {
  digitalWrite(0, LOW);
  digitalWrite(1, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);
}

void second_num_eight() {
  digitalWrite(0, LOW);
  digitalWrite(1, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
}

void second_num_nine() {
  digitalWrite(0, LOW);
  digitalWrite(1, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
}


void first_ascended_num() {
  first_num_zero();   second_ascended_num();   delay(500);
  first_num_one();    second_ascended_num();   delay(500);
  first_num_two();    second_ascended_num();   delay(500);
  first_num_three();  second_ascended_num();   delay(500);
  first_num_four();   second_ascended_num();   delay(500);
  first_num_five();   second_ascended_num();   delay(500);
  first_num_six();    second_ascended_num();   delay(500);
  first_num_seven();  second_ascended_num();   delay(500);
  first_num_eight();  second_ascended_num();   delay(500);
  first_num_nine();
}

void first_descended_num() {
  first_num_nine();   second_descended_num();  delay(500);
  first_num_eight();  second_descended_num();  delay(500);
  first_num_seven();  second_descended_num();  delay(500);
  first_num_six();    second_descended_num();  delay(500);
  first_num_five();   second_descended_num();  delay(500);
  first_num_four();   second_descended_num();  delay(500);
  first_num_three();  second_descended_num();  delay(500);
  first_num_two();    second_descended_num();  delay(500);
  first_num_one();    second_descended_num();  delay(500);
  first_num_zero();   second_descended_num();  delay(500);
}

void second_ascended_num() {
  second_num_zero();   delay(500);
  second_num_one();    delay(500);
  second_num_two();    delay(500);
  second_num_three();  delay(500);
  second_num_four();   delay(500);
  second_num_five();   delay(500);
  second_num_six();    delay(500);
  second_num_seven();  delay(500);
  second_num_eight();  delay(500);
  second_num_nine();  
}

void second_descended_num() {
  second_num_nine();    delay(500);
  second_num_eight();   delay(500);
  second_num_seven();   delay(500);
  second_num_six();     delay(500);
  second_num_five();    delay(500);
  second_num_four();    delay(500);
  second_num_three();   delay(500);
  second_num_two();     delay(500);
  second_num_one();     delay(500);
  second_num_zero();    delay(500);
}

void setup() {

  output_mode();
}

void loop() {

  first_ascended_num();
  first_descended_num();
}