Combine Display+Controls with Pizza oven

Use more loops

for (I = 0; I < 10; I++) {

  double c1 = thermocouple1.readCelsius();
  double c2 = thermocouple2.readCelsius();

  if (isnan(c1)) {
    Serial.println("Something wrong with thermocouple 1!");
  } else {
    if (isnan(c2)) {
      Serial.println("Something wrong with thermocouple 2!");
    }
    delay(100);
  }
  Array1[I] = c1;
  Array2[I] = c2;
}

Avgc1 = 0;
Avgc2 = 0;

for (I = 0; I < 10; I++) {

  Avgc1 += Array1[I];
  Avgc2 += Array2[I];
}

Avgc1 /= 10.0;
Avgc2 /= 10o.;

Use less storage

Avgc1 = 0;
Avgc2 = 0;

for (I = 0; I < 10; I++) {

  double c1 = thermocouple1.readCelsius();
  double c2 = thermocouple2.readCelsius();

  if (isnan(c1)) {
    Serial.println("Something wrong with thermocouple 1!");
  } else {
    if (isnan(c2)) {
      Serial.println("Something wrong with thermocouple 2!");
    }
    delay(100);
  }
  
  Avgc1 +=  c1;
  Avgc2 +=  c2;
}

Avgc1 /= 10.0;
Avgc2 /= 10.0;

Read more code.

Use functions.

This temperature thing I'm compelled to tinker with while I wait for cocktail hour to officially begin could be a function. Use of functions to subordinate code that works reliably makes the main line code easier to read.

So the main line, loop() here in Arduino-land, will read more like an outline of your story than a run-on paragraph.

HTH

a7

1 Like