Adafruit MagTag的辅助库
项目描述
简介
Adafruit MagTag的辅助库。
依赖项
此驱动程序依赖于
请确保所有依赖项都可在CircuitPython文件系统中使用。这可以通过下载Adafruit库和驱动程序捆绑包轻松实现。
使用示例
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
import time
import terminalio
from adafruit_magtag.magtag import MagTag
magtag = MagTag()
magtag.add_text(
text_font=terminalio.FONT,
text_position=(
50,
(magtag.graphics.display.height // 2) - 1,
),
text_scale=3,
)
magtag.set_text("Hello World")
buttons = magtag.peripherals.buttons
button_colors = ((255, 0, 0), (255, 150, 0), (0, 255, 255), (180, 0, 255))
button_tones = (1047, 1318, 1568, 2093)
timestamp = time.monotonic()
while True:
for i, b in enumerate(buttons):
if not b.value:
print("Button %c pressed" % chr((ord("A") + i)))
magtag.peripherals.neopixel_disable = False
magtag.peripherals.neopixels.fill(button_colors[i])
magtag.peripherals.play_tone(button_tones[i], 0.25)
break
else:
magtag.peripherals.neopixel_disable = True
time.sleep(0.01)
文档
此库的API文档可以在Read the Docs上找到。
有关构建库文档的信息,请参阅此指南。
贡献
欢迎贡献!请在贡献之前阅读我们的行为准则,以帮助本项目保持开放。
项目详情
关闭
adafruit-circuitpython-magtag-2.2.10.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | bbfd3e086ba42ec38e3995b626f4478c398eea38c66bd1cbe84b2b1e0552166e |
|
MD5 | 181f814d5d7b454fb7dda089b09f1bcc |
|
BLAKE2b-256 | 26267d2aa6524d1a77d7e4602c812756eb6233d795e06a45a41a1f370e4b8860 |
关闭
adafruit_circuitpython_magtag-2.2.10-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 61ae8d8893f75f0cf3deb919b27a619d085350f151974ea0009bf63222ba43f6 |
|
MD5 | f7c48b34fe79c3fc4f26c340c22f1e24 |
|
BLAKE2b-256 | ac2f58430228b35806f17526c2d9207a7f2b96840baef1e737f4d13ea1bb95fc |