显示简单文字(simple_text_display)
CLUE可以通过下面函数显示多行文字,每行的文字、颜色、大小、字体都可以单独设置
simple_text_display(title=None, title_color=(255, 255, 255), title_scale=1, text_scale=1, font=None, colors=None)
-
title,标题(第一行)
-
title_color,标题颜色,默认是(255, 255, 255)
-
title_scale,标题显示比例
-
text_scale,文字显示比例
-
font,字体,默认是内置的terminalio.FONT
-
colors,文字颜色列表,
from adafruit_clue import clue
clue_data = clue.simple_text_display(title="CLUE Sensor Data!", title_scale=2)
while True:
clue_data[0].text = "Acceleration: {:.2f} {:.2f} {:.2f}".format(*clue.acceleration)
clue_data[1].text = "Gyro: {:.2f} {:.2f} {:.2f}".format(*clue.gyro)
clue_data[2].text = "Magnetic: {:.3f} {:.3f} {:.3f}".format(*clue.magnetic)
clue_data.show()
|