Compare commits

..

3 Commits

Author SHA1 Message Date
21d0363765 [修改] 修改LED标题显示
[详细说明]
    1. 使用系统字体ttf文件:DejaVuSans.ttf;
    2. 调整字体大小:12
2023-07-02 22:48:51 +08:00
1d4229f7c1 [修改] 提交测试 2023-07-02 22:08:09 +08:00
5e3dc45302 [修改] 更新Readme 2023-07-02 21:52:59 +08:00
3 changed files with 6 additions and 3 deletions

View File

@ -58,7 +58,9 @@ class OLED(object):
image = self.image
# Load default font.
font = ImageFont.load_default()
# font = ImageFont.load_default()
font_path = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
font = ImageFont.truetype(font_path, size)
# Write two lines of text.
draw.text((x, y), text, font=font, fill=255)

View File

@ -1,2 +1,3 @@
# Raspi-Home
# Raspi-SmartHome
A Raspberry Pi-based smart home project built on Python.

View File

@ -42,7 +42,7 @@ def main():
led_blink = threading.Thread(target=blink_loop, name='led_blink', args=(LED_GPIO_RED,))
led_blink.start()
oled.draw_text(0, 0, 16, 'Hello, workld')
oled.draw_text(0, 0, 14, 'Raspi-SmartHome')
while True:
time.sleep(1)