Introduction
Helper library for the Adafruit MagTag.
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Usage Example
# 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)
Documentation
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Metadata
Release files for adafruit-circuitpython-magtag 2.2.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| adafruit_circuitpython_magtag-2.2.18.tar.gz | 27.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| adafruit_circuitpython_magtag-2.2.18-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.8 kB
Release files / adafruit_circuitpython_magtag-2.2.18.tar.gz
| Download URL | adafruit_circuitpython_magtag-2.2.18.tar.gz |
|---|---|
| Size | 27.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa5571e8f0764799632520ae6404cbfae40688d43626c79872e417b5a03e6218
|
|
BLAKE2b-256 checksum How to use checksums |
dad7fd06f2f65dbb336d4ea788a036f9a6edba4fe418833082014ee51e5df8ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / adafruit_circuitpython_magtag-2.2.18-py3-none-any.whl
| Download URL | adafruit_circuitpython_magtag-2.2.18-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac99cfb8475fc5e97a5a861dc03940dd84955617d0e2e0139d63456622721e09
|
|
BLAKE2b-256 checksum How to use checksums |
de4d18017ac1326fe84ae26965837eb49e59604dce60b12106d90de63da3a963
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|