Code Bug for loop

Good day everyone, can anyone help me with the bug i have?
image

#include <TimerOne.h>

int a = 2;
int b = 3;
int c = 4;
int d = 5;
int e = 6;
int f = 7;
int g = 8;
int p = 9;
int A = 16;
int B = 17;
int C = 18;
int D = 19;
int E = 20;
int F = 21;
int G = 22;
int H = 23;
int P = 24;

int d4 = 10;
int d3 = 11;
int d2 = 12;
int d1 = 13;
int d8 = 25;
int d7 = 26;
int d6 = 27;
int d5 = 28;

int machineon = 30;
int machineoff = 31;

long n = 0;// n represents the value displayed on the LED display. For example, when n=0, 0000 is displayed. The maximum value is 9999.
long m = 0;
int x = 100;
int y = 100;

int del = 5;//Set del as 5; the value is the degree of fine tuning for the clock
int count = 0;//Set count=0. Here count is a count value that increases by 1 every 0.1 second, which means 1 second is counted when the value is 10
int count1 = 0;
int seconds=0,minutes=0,hours=0;
int add;

void setup()
{
  pinMode(d1, OUTPUT);
  pinMode(d2, OUTPUT);
  pinMode(d3, OUTPUT);
  pinMode(d4, OUTPUT);
  pinMode(a, OUTPUT);
  pinMode(b, OUTPUT);
  pinMode(c, OUTPUT);
  pinMode(d, OUTPUT);
  pinMode(e, OUTPUT);
  pinMode(f, OUTPUT);
  pinMode(g, OUTPUT);
  pinMode(p, OUTPUT);
  pinMode(d5, OUTPUT);
  pinMode(d6, OUTPUT);
  pinMode(d7, OUTPUT);
  pinMode(d8, OUTPUT);
  pinMode(A, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);
  pinMode(D, OUTPUT);
  pinMode(E, OUTPUT);
  pinMode(F, OUTPUT);
  pinMode(G, OUTPUT);
  pinMode(P, OUTPUT);
  
  Serial.begin(9600);
  Timer1.initialize(100000); // set a timer of length 100000 microseconds (or 0.1 sec - or 10Hz => the led will blink 5 times, 5 cycles of on-and-off, per second)
  Timer1.attachInterrupt( add ); // attach the service routine here
}
void loop()
{
  void runtime();
  void downtime();
}
void runtime()
{
void display1()
{
  int digit_value_1;
  int digit_value_2;
  int digit_value_3;
  int digit_value_4; 
  if (digitalRead(machineon) == HIGH)
  {
    // 1. Load number 1

    digit_value_1 = seconds % 10;
    digit_value_2 = (seconds / 10) % 10;

    // 2. Load number 2

    digit_value_3 = (minutes) % 10;
    digit_value_4 = (minutes / 10) % 10;
    }

    //3. Update number to display
    pickDigit(0);//Light up 7-segment display d1
    pickNumber(digit_value_1);// get the value of thousand
    delay(del);//delay 5ms

    pickDigit(1);//Light up 7-segment display d2
    pickNumber(digit_value_2);// get the value of hundred
    delay(del);//delay 5ms

    pickDigit(2);//Light up 7-segment display d3
    pickNumber(digit_value_3);//get the value of ten
    delay(del);//delay 5ms

    pickDigit(3);//Light up 7-segment display d4
    pickNumber(digit_value_4);//Get the value of single digit
    delay(del);//delay 5ms

    delay(1);//loop delay update every 1 ms
}

void pickDigit(int x) //light up a 7-segment display
{
  switch(x)
  {
    case 0: 
        digitalWrite(d1, HIGH); digitalWrite(d2, LOW);digitalWrite(d3, LOW);digitalWrite(d4, LOW);
        break;
    case 1: 
        digitalWrite(d1, LOW); digitalWrite(d2, HIGH); digitalWrite(d3, LOW);digitalWrite(d4, LOW); 
        break;
    case 2:
        digitalWrite(d1, LOW);digitalWrite(d2, LOW); digitalWrite(d3, HIGH); digitalWrite(d4, LOW); 
        break;
      
    case 3:
        digitalWrite(d1, LOW);digitalWrite(d2, LOW);digitalWrite(d3, LOW);digitalWrite(d4, HIGH); 
        break;
    
    default: 
        digitalWrite(d1, LOW);digitalWrite(d2, LOW);digitalWrite(d3, LOW);digitalWrite(d4, LOW);  
        break;
  }
}

void pickNumber(int x)
{
  switch(x)
  {
     case 0: 
      zero(); 
      break;
    case 1: 
      one(); 
      break;
    case 2: 
      two(); 
      break;
    case 3: 
      three(); 
      break;
    case 4: 
      four(); 
      break;
    case 5: 
      five(); 
      break;
    case 6: 
      six(); 
      break;
    case 7: 
      seven(); 
      break;
    case 8: 
      eight(); 
      break;
    case 9: 
      nine(); 
      break;
    default: 
      zero(); 
      break;
  }
}


void clearLEDs() 
{
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(p, HIGH);
}

void zero() //display 0
{
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, HIGH);
}

void one() //display 1
{
  digitalWrite(a, HIGH);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);;
}

void two() //display 2
{
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, HIGH);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, HIGH);
  digitalWrite(g, LOW);
}
void three() //display 3
{
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, LOW);
}

void four() //display 4
{
  digitalWrite(a, HIGH);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
}

void five() //display 5
{
  digitalWrite(a, LOW);
  digitalWrite(b, HIGH);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, HIGH);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
}

void six() //display 6
{
  digitalWrite(a, LOW);
  digitalWrite(b, HIGH);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
}

void seven() //display 7
{
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
}

void eight() //display 8
{
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
}

void nine() //display 9
{
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, HIGH);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
}

void add()
{
  if (digitalRead(machineon)==HIGH)
  {
  if (count < 10)
  {

    count ++;
  }

  else
  {
    count = 0;
    if (seconds < 59) seconds++;

    else
    {
      seconds = 0;
      if (minutes < 59)minutes++;

      else
      {
        minutes = 0;
        if (hours < 23)hours++;
        else hours = 0;
      }
    }
  }
  }
}
}
void downtime()
{
void display2()
{
  int digit_value_5;
  int digit_value_6;
  int digit_value_7;
  int digit_value_8; 
  if (digitalRead(machineoff) == HIGH)
  {
    // 1. Load number 1

    digit_value_5 = seconds % 10;
    digit_value_6 = (seconds / 10) % 10;

    // 2. Load number 2

    digit_value_7 = (minutes) % 10;
    digit_value_8 = (minutes / 10) % 10;
    }

    //3. Update number to display
    pickDigit(0);//Light up 7-segment display d1
    pickNumber(digit_value_5);// get the value of thousand
    delay(del);//delay 5ms

    pickDigit(1);//Light up 7-segment display d2
    pickNumber(digit_value_6);// get the value of hundred
    delay(del);//delay 5ms

    pickDigit(2);//Light up 7-segment display d3
    pickNumber(digit_value_7);//get the value of ten
    delay(del);//delay 5ms

    pickDigit(3);//Light up 7-segment display d4
    pickNumber(digit_value_8);//Get the value of single digit
    delay(del);//delay 5ms

    delay(1);//loop delay update every 1 ms
}
void pickDigit1(int y) //light up a 7-segment display
{
  switch(y)
  {
    case 0: 
        digitalWrite(d5, HIGH); digitalWrite(d6, LOW);digitalWrite(d7, LOW);digitalWrite(d8, LOW);
        break;
    case 1: 
        digitalWrite(d5, LOW); digitalWrite(d6, HIGH); digitalWrite(d7, LOW);digitalWrite(d8, LOW); 
        break;
    case 2:
        digitalWrite(d5, LOW);digitalWrite(d6, LOW); digitalWrite(d7, HIGH); digitalWrite(d8, LOW); 
        break;
      
    case 3:
        digitalWrite(d5, LOW);digitalWrite(d6, LOW);digitalWrite(d7, LOW);digitalWrite(d8, HIGH); 
        break;
    
    default: 
        digitalWrite(d5, LOW);digitalWrite(d6, LOW);digitalWrite(d7, LOW);digitalWrite(d8, LOW);  
        break;
  }
}
void pickNumber1(int y)
{
  switch(y)
  {
     case 0: 
      zeros(); 
      break;
    case 1: 
      ones(); 
      break;
    case 2: 
      twos(); 
      break;
    case 3: 
      threes(); 
      break;
    case 4: 
      fours(); 
      break;
    case 5: 
      fives(); 
      break;
    case 6: 
      sixs(); 
      break;
    case 7: 
      sevens(); 
      break;
    case 8: 
      eights(); 
      break;
    case 9: 
      nines(); 
      break;
    default: 
      zeros(); 
      break;
  }
}
void zeros() //display 0
{
  digitalWrite(A, LOW);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
  digitalWrite(E, LOW);
  digitalWrite(F, LOW);
  digitalWrite(G, HIGH);
}
void ones() //display 1
{
  digitalWrite(A, HIGH);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, HIGH);
  digitalWrite(E, HIGH);
  digitalWrite(F, HIGH);
  digitalWrite(G, HIGH);;
}

void twos() //display 2
{
  digitalWrite(A, LOW);
  digitalWrite(B, LOW);
  digitalWrite(C, HIGH);
  digitalWrite(D, LOW);
  digitalWrite(E, LOW);
  digitalWrite(F, HIGH);
  digitalWrite(G, LOW);
}
void threes() //display 3
{
  digitalWrite(A, LOW);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
  digitalWrite(E, HIGH);
  digitalWrite(F, HIGH);
  digitalWrite(G, LOW);
}

void fours() //display 4
{
  digitalWrite(A, HIGH);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, HIGH);
  digitalWrite(E, HIGH);
  digitalWrite(F, LOW);
  digitalWrite(G, LOW);
}

void fives() //display 5
{
  digitalWrite(A, LOW);
  digitalWrite(B, HIGH);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
  digitalWrite(E, HIGH);
  digitalWrite(F, LOW);
  digitalWrite(G, LOW);
}

void sixs() //display 6
{
  digitalWrite(A, LOW);
  digitalWrite(B, HIGH);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
  digitalWrite(E, LOW);
  digitalWrite(F, LOW);
  digitalWrite(G, LOW);
}

void sevens() //display 7
{
  digitalWrite(A, LOW);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, HIGH);
  digitalWrite(E, HIGH);
  digitalWrite(F, HIGH);
  digitalWrite(G, HIGH);
}

void eights() //display 8
{
  digitalWrite(A, LOW);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
  digitalWrite(E, LOW);
  digitalWrite(F, LOW);
  digitalWrite(G, LOW);
}

void nines()
{
  digitalWrite(A, LOW);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
  digitalWrite(E, HIGH);
  digitalWrite(F, LOW);
  digitalWrite(G, LOW);
}
}


You have lots of problems there, but the one highlighted is that you have a function definition (display) inside another function (runtime).

Please post error messages, not pictures of error messages

Arduino: 1.8.16 (Windows Store 1.8.51.0) (Windows 10), Board: "Arduino Uno"

C:\Users\user\Desktop\2displaycode\2displaycode.ino: In function 'void setup()':

C:\Users\user\Desktop\2displaycode\2displaycode.ino:74:31: warning: invalid conversion from 'int' to 'void (*)()' [-fpermissive]

   Timer1.attachInterrupt( add ); // attach the service routine here

                               ^

In file included from C:\Users\user\Desktop\2displaycode\2displaycode.ino:1:0:

C:\Users\user\Documents\Arduino\libraries\TimerOne/TimerOne.h:141:10: note:   initializing argument 1 of 'void TimerOne::attachInterrupt(void (*)())'

     void attachInterrupt(void (*isr)()) __attribute__((always_inline)) {

          ^~~~~~~~~~~~~~~

C:\Users\user\Desktop\2displaycode\2displaycode.ino: In function 'void runtime()':

2displaycode:84:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:123:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:147:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:188:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:200:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:211:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:222:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:232:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:243:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:254:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:265:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:276:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:287:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:298:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:309:1: error: a function-definition is not allowed here before '{' token

 {

 ^

C:\Users\user\Desktop\2displaycode\2displaycode.ino: In function 'void downtime()':

2displaycode:342:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:380:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:403:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:442:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:452:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:463:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:473:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:484:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:495:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:506:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:517:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:528:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:539:1: error: a function-definition is not allowed here before '{' token

 {

 ^

2displaycode:549:1: error: a function-definition is not allowed here before '{' token

 {

 ^

exit status 1

a function-definition is not allowed here before '{' token



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

That's an unusual place to put function prototypes.

You probably meant

void loop()
{
  runtime();
  downtime();
}

But you need to sort out all the other nested function definitions first.

Also, variables and functions with the same name is a no-no.

ok sir, i have corrected it

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.