Skip to content

Commit 005aed1

Browse files
authored
Clarify leading zero handling in time display
Per guide feedback where a user wanted suppressed zero on times from 01:00 to 09:59. Guide will be augmented per Ladyada to allow the user to select which behavior they want just by commenting out a line and uncommenting out the desired behavior Default is the code as written that does not suppress a zero.
1 parent e575e8f commit 005aed1

File tree

1 file changed

+3
-1
lines changed
  • Digital_Clock_with_CircuitPython

1 file changed

+3
-1
lines changed

Digital_Clock_with_CircuitPython/code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def clock_conversion(h, m, set_brightness):
5858
hour_12 = h if h <= 12 else h - 12
5959
if hour_12 == 0:
6060
hour_12 = 12
61-
display.print(f"{(hour_12):02}:{m:02}")
61+
display.print(f"{(hour_12):02}:{m:02}") # Use for leading zero re. 09:35
62+
# display.print(f"{hour_12:2}:{m:02}") # uncomment to suppress leading zero
63+
# # (shows 1:00 instead of 01:00)
6264
display.ampm = am_pm
6365
if set_brightness:
6466
if awake_hours[0] <= h <= awake_hours[1] - 1:

0 commit comments

Comments
 (0)