In context with my published project on the 7 segment display, I have left me two challenges unanswered, to which I know no answer:
My primary question is, can I switch on/off the LED display (I need it at night only for a few seconds via a PIR motion sensor or touch sensor to activate the display; otherwise it will be permanently switched off.)?
My second question is, how can I manipulate the display to also outputs the representation of a leading 0 during hour 0 (0:03 instead of x:x3)?
// Get the current time in HHMM format
the_time = Time.hour()*100+Time.minute();
//Serial.println(the_time);
In order to display leading zeros you may need to print the time digit by digit and not as number.
This also allows you to print an empty string (together with stopping the seconds toggle of the colon) to switch the display off - or you set the brightness to 0.
Thx for example and helpful hints: solved the point with the leading zeros as follow:
// Get the current time in HHMM format
the_time = Time.hour()*100+Time.minute();
//Serial.println(the_time);
// Display the time in 24 hour format
if(TWENTYFOUR_HOUR==1) {
matrix.print(the_time);
if (Time.hour() == 0) {
matrix.writeDigitNum(1, 0); // = first value = number of digit - in this case = second digit, starts with 0 to 4; second value = value to display
}
if (Time.minute() <= 9) {
matrix.writeDigitNum(3, 0); // = first value = number of digit - in this case = third digit, starts with 0 to 4; second value = value to display
}
Yes, the brightness is set by this command: matrix.setBrightness(brightness); // max brightness: 15
but also with brightness = 0 the display is on and shines a bit bright.