kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Adjust clock.py
Clock now uses smaller font so it fits on the screenpull/795/head
rodzic
9307ea1360
commit
d759522b08
|
@ -50,6 +50,8 @@ The easiest way to start displaying cool stuff on Stellar Unicorn is using our S
|
|||
|
||||
Clock example with (optional) NTP synchronization. You can adjust the brightness with LUX + and -, and resync the time by pressing A.
|
||||
|
||||
This examples uses a custom tiny bitmap font, find 3x5.bitmapfont in [fonts](../../fonts) and copy it to your Pico W.
|
||||
|
||||
### Eighties Super Computer
|
||||
|
||||
[eighties_super_computer.py](eighties_super_computer.py)
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
# WIFI_PASSWORD = "Your WiFi password"
|
||||
#
|
||||
# Clock synchronizes time on start, and resynchronizes if you press the A button
|
||||
#
|
||||
# This example uses a custom tiny font - find 3x5.bitmapfont in pimoroni-pico/fonts
|
||||
|
||||
import time
|
||||
import math
|
||||
|
@ -193,7 +195,7 @@ def redraw_display_if_reqd():
|
|||
gradient_background(hue, sat, val,
|
||||
hue + HUE_OFFSET, sat, val)
|
||||
|
||||
clock = "{:02}:{:02}:{:02}".format(hour, minute, second)
|
||||
clock = "{:02} {:02}".format(hour, minute)
|
||||
|
||||
# calculate text position so that it is centred
|
||||
w = graphics.measure_text(clock, 1)
|
||||
|
@ -206,7 +208,7 @@ def redraw_display_if_reqd():
|
|||
|
||||
|
||||
# set the font
|
||||
graphics.set_font("bitmap6")
|
||||
graphics.set_font(open("3x5.bitmapfont", "rb").read())
|
||||
su.set_brightness(0.5)
|
||||
|
||||
sync_time()
|
||||
|
|
Ładowanie…
Reference in New Issue