Neo7SegmentClock icon indicating copy to clipboard operation
Neo7SegmentClock copied to clipboard

12h format

Open Mo-albabtain opened this issue 4 years ago • 3 comments

Hi there,

thank you for the amazing work. Is it possible to change the time format to display 12h instead of 24h

I tried editing
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S"); to Serial.println(&timeinfo, "%A, %B %d %Y %I:%M:%S"); but no luck. Do you know any other way?

Thanks a lot

Mo-albabtain avatar May 16 '21 07:05 Mo-albabtain

Hi! That just changes how the time is printed to the terminal, to change what is displayed on the clock, edit the next line:

count=(timeinfo.tm_hour*100+timeinfo.tm_min);

I'd set up an if statement along the lines of if timeinfo.tm_tm_hour>12 then subtract 12 before multiplying by 100. I'd type it all out but I'm on mobile. Hopefully that helps!

mattncsu avatar May 16 '21 12:05 mattncsu

Thanks for the response. That's what I did and it works fine if (timeinfo.tm_hour>12) { a = timeinfo.tm_hour-12; } count=(a*100+timeinfo.tm_min);

Do you have any idea how to not display zeros in hours like 6:14 instead of 06:14

Thanks again for your help

Mo-albabtain avatar May 19 '21 01:05 Mo-albabtain

Hey, sorry for the delay... Edit line 224 that controls what is shown when 0 is the first digit on the display: if (c1000 == 0) { seg1G = segCOLOR; }

What that does currently is black out the middle segment to turn an "8" (all segments on) to a "0" (middle segment off). Edit the code to turn off all the segments when 0 is displayed in the first position.

mattncsu avatar May 21 '21 03:05 mattncsu