Digital Lap counter code cleanup assistance

Hi everyone,

Blah to that title, cut it was the best I could come up with.

I’m working with a local race track to refurbish the lap counter that was originally installed in the 1970s and has way too many hands in it (wires not labeled, spliced with different types/colors, you know the deal).

I poorly programmed a lap counter (they still want to increment it manually) and the code is attached.

What I want to know is:
Is there a way to create a variable that controls multiple outputs simultaneously.

Code snippet and methodology:
onesUR = the upper-right segment in a 7 segment number box.

Up = up button

Dn = Dn button

Reset = resets the counter back to zero

The goal:

Create variables for each number and position, so I would have a variable for
onesONE that would turn on and off the necessary relays to display a two on the board that I could reference. Perhaps even an allOFF that turns off all relays or allON that turns them all on allowing even more cleanup. I need this because programming every bar to reset to calculate for up or down button presses will use all the memory after 100 laps and this counter needs to go to 250.

Then in my actual counter section, I can just reference these variables.

Hardware:
Arduino Mega

::edit:: I apologize for forgetting my code. I added it, but it made me wait 5 minutes.
This seems like it would be very easy to do, I just lack the experience.

scoreboard_v.2.ino (5.65 KB)

Yes, that is easy to do. Can even do with remote control. Simple 30-minute countdown timer I did recently: https://www.youtube.com/watch?v=oy0jpy6rHsA

I use separate variable for each digit as well.
pseudocode:

if (digitalRead(updateButton) == 0){ // button wired to connect pin to Gnd, internal pullup enabled
ones = ones +1;
if (ones == 10){  // rollover check
updateDisplay = 1;
ones = 0;
tens = tens +1;
if (tens == 10){  // rollover check
tens = 0;
hundreds = hundreds +1;
if (hundreds == 10){  // rollover check
hundreds = 0;
} // hundreds check
} // tens check
} // ones check
} // button test
// and similar for counting down, with roll-under check, borrow from upper digit if needed

if (updateDisplay == 1){
updateDisplay = 0;
digitalWrites (ssPin, LOW); // assuming you have part like TPIC6B595 to sink current thru LEDs (you mention relays?)
SPI.transfer(fontArray[ones]);
SPI.transfer(fontArray[tens]);
SPI.transfer(fontArray[hundreds]);
digitalWrites (ssPin, HIGH);  // all outputs update on this rising edge
}

and then a lookup array to map the digits

byte fontArray{} = { 
0b00111111, // 0  DP (if used)-G-F-E-D-C-B-A
0b00000110, // 1          A        1 = segment on
0b01011011, // 2    F          B
0b01001111, // 3          G
0b01100110, // 4    E          C
0b01101101, // 5          D         DP
0b01111101, // 6
0b00000111, // 7
0b01111111. // 8
0b01101111, // 9
};