Loop failure after unset amount of time.

I am building an art piece that takes in input from three rotary encoders and two buttons. and outputs data to a large neopixel display and 2 large 4 digit seven segment displays. The displays are powered by the arduino 5V the neopixels are powered by a separate power source.

Everything works exactly as expected for a time. Then seemingly at random the code discontinues responding to any input. The seven segment displays continue to light up.

I believe it might be a power issue with the arduino overheating due to the power consumption of the seven segment displays (~300mA), however, the arduino is still "on" or reviecing power.

I have attached my code below as I worry that problem might come from a runtime error there rather that a power issue. Any advice is greatly appreciated

problemCode.ino (8.35 KB)

Please post a schematic as well. Code without a schematic is meaningless.
Do not post a Fritzing physical layout diagram as they are useless.

Have you got the ground of the LED’s power supply connected to the ground of the Arduino. Do you have a series resistor in the data line and a large capacitor across the power input of the strip.

I will make a schematic once I return home to continue work on the device.

I have everything grounded together. However, I have never heard of using a resistor on the data line or the use of a capacitor over the power source for and LED array.

Does the resistor protect the arduino? I have no data transmission problems until everything stops functioning.

A couple of things after having a quick look at your code:

Variables used to store values from millis() need to be unsigned long, not long.

You should avoid the use of Strings, the arduino doesn't handle Strings well and often results in memory corruption after an indeterminate amount of time.

Your function that uses Strings seems that it could easily accomplish the same thing using only integers.

short combine(byte month, byte day){
  //takes the two bytes and truns them into one long digit
  holder1 = String(month);
  holder2 = String(day);

  if(holder1.length()==1){
    holder1 = "0" + holder1;
  }
  if(holder2.length()==1){
    holder2 = "0" + holder2;
  }
  

  holder = holder1 + holder2;

  return(holder.toInt());
}

Appears to be equivalent to: (not sure why you are using short, normally I'd use int or int16_t)

short combine(byte month, byte day){
  //takes the two bytes and truns them into one long digit
  return ((short)month * 100 + (short)day);
}

Does the resistor protect the arduino?

No it protects the Neopixel, the first one in the chain.

However, I have never heard of using a resistor on the data line or the use of a capacitor over the power source for and LED array.

You must get out more