Como crear varios contadores para diferentes señales

Hola buen día.

¿Podrían ayudarme con mi código?

Tengo de proyecto mostrar cuanto tiempo llevan encendida diferentes maquinas.
Estoy utilizando el arduino Mega2560.

Debo recibir 5 señales de 5 maquinas respectivamente, y según cada una debe empezar a contar el tiempo independientemente de las demás y mostrármelo en un Display, ya tengo para que me muestre las horas y minutos, si es la señal S1, S2, etc.

Pero no se como hacerle para simplificar lo del contador por que no quiero tener que inicializar variables para cada señal.

#include "SevSeg.h"

SevSeg sevseg;   //Instanciamos el object
//Inicia para maquina 1
int hora = 0;
int minuto = 0;
int segundo = 0;

//Inicia para maquina 2
int hora2 = 0;
int minuto2 = 0;
int segundo2 = 0;

unsigned long tiempo1 = 0;
unsigned long tiempo2 = 0;
long actual = 500000;
long actual2 = 500000;

int Paro;     // variable para la señal de Paro
int Paro2;     // variable para la señal de Paro2
int Reset;   // variable para la señal de RESET

void setup()
{
  pinMode(Paro, INPUT);
  pinMode(Paro2, INPUT);
  pinMode(Reset, INPUT);

  //Display 7seg izquierdo hrs min
  byte hardwareConfig = N_TRANSISTORS;  //Indica que es cátodo común con NPN
  byte numDigits = 6;
  byte digitPins[] = {13, 12, 11, 10, 9, 8}; //transistores
  byte segmentPins[] = {1, 2, 3, 4, 5, 6, 7}; //ABCDEFG
  bool resistorsOnSegments = true;     //true indica que resistencia esta en el pin de segmento
  bool updateWithDelays = false;       //Recomendado
  bool leadingZeros = true;            //true muestra ceros a izquierda
  sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros);
  sevseg.setBrightness(60);

}

void loop()
{
  un_seg (); //void un seg

  if ( millis()<1000) {
    sevseg.setNumber(actual, 6);
  }
  contador(); //void contador
  unsigned long mils = millis();
  if ((Paro == 1) && (Reset == 0)) //Maquina 1
  {
    actual = 510000 + (hora * 100) + (segundo);
    sevseg.setNumber(actual, 6);
  }
  if ((Paro2 == 1) && (Reset == 0)) //Maquina2
  {
    actual2 = 520000 + (hora2 * 100) + (segundo2);
    sevseg.setNumber(actual2, 6);
  }
  sevseg.refreshDisplay();

  Paro = digitalRead(26);
  Paro2 = digitalRead(27);
  Reset = digitalRead(28);
}

void un_seg()
{
  tiempo2 = (millis() / 1000);
  if (( tiempo1 != tiempo2 ) && (Paro == 1)) {
    tiempo1 = tiempo2;
    segundo++;
  }
  if (( tiempo1 != tiempo2 ) && (Paro2 == 1)) {
    tiempo1 = tiempo2;
    segundo2++;
  }
}

void contador() {
  //rutina segundos
  if (( segundo == 61 ) || ( segundo2 == 61 )) {
    segundo = 0;
    segundo++;

    segundo2 = 0;
    segundo2++;
  }

  if ( ( segundo == 60 ) || ( segundo2 == 60 ) ) {
    segundo = 0;
    minuto++;

    segundo2 = 0;
    minuto2++;
  }
  
  // Rutina para los minutos
  if ((minuto == 61 ) || (minuto2 == 61 )) {
    minuto = 0;
    minuto++;

    minuto2 = 0;
    minuto2++;
  }

  if ( ( minuto == 60 ) || ( minuto2 == 60 )) {
    minuto = 0;
    hora++;

    minuto2 = 0;
    hora2++;
  }

  // Rutina para las horas
  if (( hora == 25 ) || ( hora2 == 25 )) {
    hora = 0;
    hora++;

    hora2 = 0;
    hora2++;
  }

  if ( (hora == 24) || (Reset == 1) || (hora2 == 24) ) {
    hora = 0;
    minuto = 0;
    segundo = 0;
    actual = 500000;

    hora2 = 0;
    minuto2 = 0;
    segundo2 = 0;
    actual2 = 500000;
  }
}

Les agradezco su ayuda.

sketch_sep19b.ino (2.89 KB)

I've deleted your other cross post @Karenfrausto.

Cross posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes writing a detailed answer on this thread, without knowing that someone else already did the same in the other thread.

Repeated cross posting will result in a suspension from the forum.

In the future, please take some time to pick the forum section that best suits the topic of your question and then only post once to that forum section. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum section. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Also, please don't post Spanish to the English language sections of the forum. If you want to post in Spanish, use the Español section:
https://forum.arduino.cc/index.php?board=32.0