Helper library for the Adafruit MagTag
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file adafruit_circuitpython_magtag-2.2.11.tar.gz
.
File metadata
- Download URL: adafruit_circuitpython_magtag-2.2.11.tar.gz
- Upload date:
- Size: 30.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a983d547635490a693f991740275453d9de7ffa1f32475d64e6b6dc067cc5c5f |
|
MD5 | ea9dbedb6a7e8ecb9730477c30b8f801 |
|
BLAKE2b-256 | 90edf286e7f717e22463bff4411902618b1447702ca081a59927ffd157f4f888 |
File details
Details for the file adafruit_circuitpython_magtag-2.2.11-py3-none-any.whl
.
File metadata
- Download URL: adafruit_circuitpython_magtag-2.2.11-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a2e0c534a849308b68fde6fa26eb5c96f97e9ce993d0e20c1cbe42ef985527f |
|
MD5 | 31facba425e905715f6c29e395aa1401 |
|
BLAKE2b-256 | 146d92b032b09889203b36bfde65d29652955201924400d2e9c3e77452e4a0d7 |