The relevant section of code is below. When I call printDigits() a single time in writeDHT (or anywhere), I get the expected result, but if I call it twice as in the code below, neither call ends up happening, leaving no output to display, and I get no error message.
Pretty new to coding, and never posted on one of these forums, if there's any other information I'd be glad to provide it.
void writeDHT() {
if (now() > lastPrint+10) {
digitalClockDisplay(true);
Serial.print("Humidity: ");
Serial.println(humAir);
Serial.print("Temperature: ");
Serial.print(temp);
Serial.println(" Farenheit");
Serial.println();
lastPrint = now();
//display.setFont(&TomThumb);
display.setTextSize(2);
display.setTextColor(WHITE);
display.clearDisplay();
display.setCursor(0,16);
display.print("TEMP: ");
display.print(round(temp));
display.print("F");
display.setCursor(12,34);
display.print("HUM: ");
display.print(round(humAir));
display.print("%");
display.setCursor(0, 54);
display.setTextSize(1);
display.print(hour());
display.print(printDigits(minute()));
display.print(printDigits(second()));
display.display();
}
}
String printDigits(int digitsInt){
// utility function for digital clock display: prints preceding colon and leading 0
String num = ":";
String digitsStr = String(digitsInt);
if(digitsInt < 10)
num = num + "0";
num = num + digitsStr;
return num;
}